Click or drag to resize

ZoomController Class

ZoomController is the default ZoomPanel controller that can be placed on the user interface and can be used to control the current ZoomMode of the ZoomPanel.
Inheritance Hierarchy

Namespace:  Ab2d.Controls
Assembly:  Ab2d.Controls.ZoomPanel (in Ab2d.Controls.ZoomPanel.dll) Version: 5.2.6631.1040
Syntax
C#
public class ZoomController : Control

The ZoomController type exposes the following members.

Constructors
  NameDescription
Public methodZoomController
Constructor
Top
Properties
  NameDescription
Public propertyIsAutoZoomPanelFindingEnabled
Gets or sets a Boolean which specifies that if TargetZoomPanel or TargetZoomPanelName properties are not manually set the first ZoomPanel is automatically found from the current UserControl, Page or Window. Default value is true.
Public propertyIsResetToLimits
Public propertyTargetZoomPanel
ZoomPanel control that is controlled by this ZoomController.
Public propertyTargetZoomPanelName
Gets or sets the name of the ZoomPanel that is controls with this ZoomController.
Top
Methods
Fields
  NameDescription
Public fieldStatic memberIsAutoZoomPanelFindingEnabledProperty
IsAutoZoomPanelFindingEnabledProperty
Public fieldStatic memberIsResetToLimitsProperty
IsResetToLimitsProperty
Public fieldStatic memberTargetZoomPanelNameProperty
TargetZoomPanelNameProperty
Public fieldStatic memberTargetZoomPanelProperty
TargetZoomPanelProperty
Top
Remarks

The ZoomController contains the following buttons: Move, Rectangle, ZoomIn, ZoomOut and Reset.

The first four buttons control the current zoom mode. If none is selected, than the current zoom mode is None - no mouse event is handled by the ZoomPanel.

The action of the reset button depends on the IsResetToLimits property. If it is false (by default) the buttons resets the ZoomPanel to show all the content - sets the Viewbox to "0 0 1 1". If its value is true, than the buttons calls ResetToLimits method that shows the whole content as it is defined by the ViewboxLimits property.

ZoomController can automatically discover the ZoomPanel in the current Window or Page. But if there are more ZoomPanels defined or you would like to explicitly set the ZoomPanel, TargetZoomPanelName or TargetZoomPanel can be used to connect ZoomController with the specific ZoomPanel. To disable the automatic discovery of ZoomPanel the IsAutoZoomPanelFindingEnabled property can be set to false.

Examples
The following example defines a default ZoomController and a ZoomPanel that enables zooming a TextBlock (the ZoomPanel is automatically discovered by ZoomController):
<Window x:Class="Ab2d.ZoomControlSample.ZoomPanelSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel">
  <Grid>
      <ab2d:ZoomPanel Name="myZoomPanel">
        <TextBlock>12345</TextBlock>
      </ab2d:ZoomPanel>
      <ab2d:ZoomController VerticalAlignment="Top" 
                           HorizontalAlignment="Right"/>
    </Grid>
</Window>
The following example uses TargetZoomPanelName to define the ZoomPanel it is controlling:
<Window x:Class="Ab2d.ZoomControlSample.ZoomPanelSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel">
  <Grid>
      <ab2d:ZoomPanel Name="myZoomPanel">
        <TextBlock>12345</TextBlock>
      </ab2d:ZoomPanel>
      <ab2d:ZoomController TargetZoomPanelName="myZoomPanel"
                           VerticalAlignment="Top" 
                           HorizontalAlignment="Right"/>
    </Grid>
</Window>
The following example uses TargetZoomPanel to define the ZoomPanel it is controlling:
<Window x:Class="Ab2d.ZoomControlSample.ZoomPanelSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel">
  <Grid>
      <ab2d:ZoomPanel Name="myZoomPanel">
        <TextBlock>12345</TextBlock>
      </ab2d:ZoomPanel>
      <ab2d:ZoomController TargetZoomPanel="{Binding ElementName=myZoomPanel}"
                           VerticalAlignment="Top" 
                           HorizontalAlignment="Right"/>
    </Grid>
</Window>
See Also