ZoomDecorator Class
Represents a decorator that can interactively zoom and pan it's child element.
public class ZoomDecorator : Decorator
- Inheritance:
- object Visual UIElement FrameworkElement Decorator object
Constructors
ZoomDecorator()
Initializes an instance of the class.
public ZoomDecorator()
Properties
AnchorPoint
The current anchor point of the view.
public Point AnchorPoint { get; }
Property Value
- Point:
The default value is
0,0.
CenterPoint
The current center point of the view.
public Point? CenterPoint { get; set; }
Property Value
- Point?:
The default value is
null.
Child
Gets or sets the single child element of a Decorator.
public override UIElement Child { get; set; }
Property Value
ChildSize
The size of the child element.
public Size ChildSize { get; }
Property Value
- Size:
The default value is
0,0.
DefaultCenterPoint
The default center point of the view.
public Point? DefaultCenterPoint { get; set; }
Property Value
- Point?:
The default value is
null.
DefaultZoomLevel
The default zoom level.
HorizontalOffset
The current horizontal offset of the content.
HorizontalScrollLineStep
The value used when incrementing and decrementing the horizontal offset by a line.
public Unit HorizontalScrollLineStep { get; set; }
Property Value
- Unit:
The default value is
1pixel.
HorizontalScrollPageStep
The value used when incrementing and decrementing the horizontal offset by a page.
public Unit HorizontalScrollPageStep { get; set; }
Property Value
- Unit:
The default value is
100percent of the viewport.
IsVirtualSpaceEnabled
A value indicating whether virtual space is enabled, which allows all parts of the content to be centered in the view.
public bool IsVirtualSpaceEnabled { get; set; }
Property Value
- bool:
trueif virtual space is enabled, which allows all parts of the content to be centered in the view; otherwisefalse. The default value isfalse.
MaxZoomLevel
A percentage value indicating the maximum zoom level of the content.
MinZoomLevel
A percentage value indicating the minimum zoom level of the content.
PanAnimationDuration
The Duration to animate the panning from one location to another.
public Duration PanAnimationDuration { get; set; }
Property Value
- Duration:
The default value is
150ms.
Remarks
Set to 0ms or Duration.Automatic to disable pan animation.
See Also
VerticalOffset
The current vertical offset of the content.
VerticalScrollLineStep
The value used when incrementing and decrementing the vertical offset by a line.
VerticalScrollPageStep
The value used when incrementing and decrementing the vertical offset by a page.
public Unit VerticalScrollPageStep { get; set; }
Property Value
- Unit:
The default value is
100percent of the viewport.
ViewportSize
The size of the viewport.
public Size ViewportSize { get; }
Property Value
- Size:
The default value is
0,0.
ZoomAnimationDuration
The Duration to animate the scale from one zoom level to the next.
public Duration ZoomAnimationDuration { get; set; }
Property Value
- Duration:
The default value is
300ms.
Remarks
Set to 0ms or Duration.Automatic to disable zoom animation.
See Also
ZoomLevel
A percentage value indicating the current zoom level of the content.
public double ZoomLevel { get; set; }
Property Value
- double:
The default value is
double.NaN, which indicates that DefaultZoomLevel will be used.
ZoomLevelAnimated
A percentage value indicating the current animated zoom level of the content.
ZoomLevelStops
The possible zoom level stops when zooming in or out incrementally.
public DoubleCollection? ZoomLevelStops { get; set; }
Property Value
- DoubleCollection:
The default value is
null, which indicates that ZoomStep should be used.
ZoomStep
The value used when incrementing and decrementing the zoom level.
Methods
ArrangeOverride(Size)
Arranges the content of a Decorator element.
protected override Size ArrangeOverride(Size finalSize)
| Parameter | Type | Description |
|---|---|---|
| finalSize | Size |
Returns
- Size:
The System.Windows.Size that represents the arranged size of this Decorator element and its child.
BeginUpdate()
Flags that a bulk update is about to begin.
public void BeginUpdate()
CenterAndZoomInToPoint(Point?)
Centers the view to the specified point and zooms the content in using ZoomLevelStops or ZoomStep.
public void CenterAndZoomInToPoint(Point? point)
| Parameter | Type | Description |
|---|---|---|
| point | Point? | The point to center; otherwise |
CenterAndZoomOutFromPoint(Point?)
Centers the view to the specified point and zooms the content out using ZoomLevelStops or ZoomStep.
public void CenterAndZoomOutFromPoint(Point? point)
| Parameter | Type | Description |
|---|---|---|
| point | Point? | The point to center; otherwise |
CenterToPoint(Point?)
Centers the view to the specified point.
public void CenterToPoint(Point? point)
| Parameter | Type | Description |
|---|---|---|
| point | Point? | The point to center; otherwise |
CenterView()
Centers the view.
public void CenterView()
CenterView(Orientation)
Centers the view.
public void CenterView(Orientation orientation)
| Parameter | Type | Description |
|---|---|---|
| orientation | Orientation | The orientation that should be centered. |
EndUpdate(bool)
Flags that a bulk update has ended.
public void EndUpdate(bool animate = true)
| Parameter | Type | Description |
|---|---|---|
| animate | bool | if set to |
LineDown(double)
Scrolls the content down by VerticalScrollLineStep multiplied by the specified factor.
public void LineDown(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the line step by. |
LineLeft(double)
Scrolls the content left by HorizontalScrollLineStep multiplied by the specified factor.
public void LineLeft(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the line step by. |
LineRight(double)
Scrolls the content right by HorizontalScrollLineStep multiplied by the specified factor.
public void LineRight(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the line step by. |
LineUp(double)
Scrolls the content up by VerticalScrollLineStep multiplied by the specified factor.
public void LineUp(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the line step by. |
MeasureOverride(Size)
Measures the child element of a Decorator to prepare for arranging it during the ArrangeOverride(Size) pass.
protected override Size MeasureOverride(Size availableSize)
| Parameter | Type | Description |
|---|---|---|
| availableSize | Size |
Returns
- Size:
The target System.Windows.Size of the element.
PageDown(double)
Scrolls the content down by VerticalScrollPageStep multiplied by the specified factor.
public void PageDown(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the page step by. |
PageLeft(double)
Scrolls the content left by HorizontalScrollPageStep multiplied by the specified factor.
public void PageLeft(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the page step by. |
PageRight(double)
Scrolls the content right by HorizontalScrollPageStep multiplied by the specified factor.
public void PageRight(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the page step by. |
PageUp(double)
Scrolls the content up by VerticalScrollPageStep multiplied by the specified factor.
public void PageUp(double factor = 1)
| Parameter | Type | Description |
|---|---|---|
| factor | double | The factor to multiply the page step by. |
Pan(double, double)
Pans the view by the specified x and y offsets.
public void Pan(double xOffset, double yOffset)
| Parameter | Type | Description |
|---|---|---|
| xOffset | double | The offset to pan along the X-axis. |
| yOffset | double | The offset to pan along the Y-axis. |
ResetView()
Resets the view to the default zoom level and center point.
public void ResetView()
ZoomIn()
Zooms the content in using ZoomLevelStops or ZoomStep.
public void ZoomIn()
ZoomInToPoint(Point?)
Zooms the content in using ZoomLevelStops or ZoomStep with the specific point as an anchor.
public void ZoomInToPoint(Point? point)
| Parameter | Type | Description |
|---|---|---|
| point | Point? | The point to anchor; otherwise |
ZoomOut()
Zooms the content out using ZoomLevelStops or ZoomStep.
public void ZoomOut()
ZoomOutFromPoint(Point?)
Zooms the content out using ZoomLevelStops or ZoomStep with the specific point as an anchor.
public void ZoomOutFromPoint(Point? point)
| Parameter | Type | Description |
|---|---|---|
| point | Point? | The point to anchor; otherwise |
ZoomToFit()
Zooms the content so that it fits with-in the bounds of the control and centers the view.
public void ZoomToFit()
ZoomToFit(bool)
Zooms the content so that it fits with-in the bounds of the control.
public void ZoomToFit(bool centerView)
| Parameter | Type | Description |
|---|---|---|
| centerView | bool | if set to |
ZoomToFit(Orientation)
Zooms the content so that it fits with-in the bounds of the control and centers the view.
public void ZoomToFit(Orientation orientation)
| Parameter | Type | Description |
|---|---|---|
| orientation | Orientation | The orientation that should be fitted. |
ZoomToFit(Orientation, bool)
Zooms the content so that it fits with-in the bounds of the control.
public void ZoomToFit(Orientation orientation, bool centerView)
| Parameter | Type | Description |
|---|---|---|
| orientation | Orientation | The orientation that should be fitted. |
| centerView | bool | if set to |
Fields
AnchorPointProperty
Defines the AnchorPoint property.
public static readonly DependencyProperty AnchorPointProperty
CenterPointProperty
Defines the CenterPoint property.
public static readonly DependencyProperty CenterPointProperty
ChildSizeProperty
Defines the ChildSize property.
public static readonly DependencyProperty ChildSizeProperty
DefaultCenterPointProperty
Defines the DefaultCenterPoint property.
public static readonly DependencyProperty DefaultCenterPointProperty
DefaultZoomLevelProperty
Defines the DefaultZoomLevel property.
public static readonly DependencyProperty DefaultZoomLevelProperty
HorizontalScrollLineStepProperty
Defines the HorizontalScrollLineStep property.
public static readonly DependencyProperty HorizontalScrollLineStepProperty
HorizontalScrollPageStepProperty
Defines the HorizontalScrollPageStep property.
public static readonly DependencyProperty HorizontalScrollPageStepProperty
IsVirtualSpaceEnabledProperty
Defines the IsVirtualSpaceEnabled property.
public static readonly DependencyProperty IsVirtualSpaceEnabledProperty
MaxZoomLevelProperty
Defines the MaxZoomLevel property.
public static readonly DependencyProperty MaxZoomLevelProperty
MinZoomLevelProperty
Defines the MinZoomLevel property.
public static readonly DependencyProperty MinZoomLevelProperty
PanAnimationDurationProperty
Defines the PanAnimationDuration property.
public static readonly DependencyProperty PanAnimationDurationProperty
VerticalScrollLineStepProperty
Defines the VerticalScrollLineStep property.
public static readonly DependencyProperty VerticalScrollLineStepProperty
VerticalScrollPageStepProperty
Defines the VerticalScrollPageStep property.
public static readonly DependencyProperty VerticalScrollPageStepProperty
ViewportSizeProperty
Defines the ViewportSize property.
public static readonly DependencyProperty ViewportSizeProperty
ZoomAnimationDurationProperty
Defines the ZoomAnimationDuration property.
public static readonly DependencyProperty ZoomAnimationDurationProperty
ZoomLevelAnimatedProperty
Defines the ZoomLevelAnimated property.
public static readonly DependencyProperty ZoomLevelAnimatedProperty
ZoomLevelProperty
Defines the ZoomLevel property.
public static readonly DependencyProperty ZoomLevelProperty
ZoomLevelStopsProperty
Defines the ZoomLevelStops property.
public static readonly DependencyProperty ZoomLevelStopsProperty
ZoomStepProperty
Defines the ZoomStep property.
public static readonly DependencyProperty ZoomStepProperty