Click or drag to resize

ViewboxEx Class

ViewboxEx is a container control that extends the WPF's Viewbox control by additionally specifying the Viewbox property that defines the area that will be shown by the Viewbox.
Inheritance Hierarchy

Namespace:  Ab2d.Controls
Assembly:  Ab2d.Controls.ZoomPanel (in Ab2d.Controls.ZoomPanel.dll) Version: 5.2.6631.1040
Syntax
C#
public class ViewboxEx : Decorator, IScrollInfo

The ViewboxEx type exposes the following members.

Constructors
  NameDescription
Public methodViewboxEx
Constructor
Top
Properties
  NameDescription
Public propertyActualContentBounds
Gets the Bounds of the contents of a ViewboxEx after the transformation were applied to it. Note that the value is changed after the ViewboxEx is rendered and not immediately after the properties change.
Public propertyActualContentSize
Gets the Size of the contents of a ViewboxEx after the transformation were applied to it.
Public propertyActualViewbox
Gets the Rect that describes the area of the content that is actally visible on the screen.
Public propertyCanHorizontallyScroll
CanHorizontallyScroll
Public propertyCanVerticallyScroll
CanVerticallyScroll
Public propertyChild
Gets or sets the single child of a ViewboxEx element.
(Overrides DecoratorChild.)
Public propertyContentSize
Gets the Size of the contents of a ViewboxEx before the transformation are applied to it.
Public propertyExtentHeight
ExtentHeight
Public propertyExtentWidth
ExtentWidth
Public propertyHorizontalOffset
HorizontalOffset
Public propertyRotationAngle
Gets or sets the rotation angle in degress, that determines the angle with witch the content of the ZoomPanel is rotated around the center of the ZoomPanel.
Public propertyScrollOwner
ScrollOwner
Public propertyStretch
Gets or sets the ViewboxEx System.Windows.Media.Stretch mode, which determines how content fits into the available space.
Public propertyStretchDirection
Gets or sets the System.Windows.Controls.StretchDirection, which determines how scaling is applied to the contents of a ViewboxEx.
Public propertyVerticalOffset
VerticalOffset
Public propertyViewbox
Gets or sets the box as Rect that determines which part of the the contents of a ViewboxEx is shown. Default value is "0 0 1 1" that shows the whole content.
Public propertyViewboxUnits
Specifies the coordinate system used by Viewbox property Default value is BrushMappingMode.RelativeToBoundingBox.
Public propertyViewportHeight
ViewportHeight
Public propertyViewportWidth
ViewportWidth
Top
Methods
  NameDescription
Public methodGetRelativeViewbox
Gets the Viewbox as Rect in relative units.
Public methodLineDown
LineDown
Public methodLineLeft
LineLeft
Public methodLineRight
LineRight
Public methodLineUp
LineUp
Public methodMakeVisible
MakeVisible
Public methodMouseWheelDown
MouseWheelDown
Public methodMouseWheelLeft
MouseWheelLeft
Public methodMouseWheelRight
MouseWheelRight
Public methodMouseWheelUp
MouseWheelUp
Public methodPageDown
PageDown
Public methodPageLeft
PageLeft
Public methodPageRight
PageRight
Public methodPageUp
PageUp
Public methodSetHorizontalOffset
SetHorizontalOffset
Public methodSetVerticalOffset
SetVerticalOffset
Top
Events
  NameDescription
Public eventActualViewboxChanged
ActualViewboxChanged occurs after the ActualViewbox value is changed.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultViewbox
Default Viewbox value
Public fieldStatic memberRotationAngleProperty
RotationAngleProperty
Public fieldStatic memberStretchDirectionProperty
StretchDirectionProperty
Public fieldStatic memberStretchProperty
StretchProperty
Public fieldStatic memberViewboxProperty
ViewboxProperty
Public fieldStatic memberViewboxUnitsProperty
ViewboxUnitsProperty
Top
Remarks

ViewboxEx is an upgrade to the WPF's Viewbox control.

In addition to set the Stretch property of the Viewbox the ViewboxEx provide additional Viewbox property. It is a System.Windows.Rect type that specifies which part of the ViewboxEx content is shown.

For example the Viewbox value "0 0 1 1" means that the whole content of the ViewboxEx will be shown - same as WPF's Viewbox.
The value "0.5 0 0.5 1" means that only the right half of the content will be shown - x starting at 50%, y starting at 0%, width 50% and height 100%.
The value "0.5 0.5 0.5 0.5" means that only the lower right quarter of the content will be shown.
The value "-1 0 3 1" means that the ViewboxEx will show the area that is 3 times wider than its content - so the content will be shown in the middle of the ViewboxEx and there will be an empty area to the left and right of the content.

Examples
The following example defines a Button that starts a RectAnimation of a VieboxEx's Viewbox.
<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>
     <Button Name="StartStoryboardButton" VerticalAlignment="Top" HorizontalAlignment="Left">Start Animation
          <Button.Triggers>
              <EventTrigger RoutedEvent="Button.Click">
                  <EventTrigger.Actions>
                      <BeginStoryboard>
                          <Storyboard Name="XamlRectStoryboard">
                              <ab2d:RectAnimation From="0 0 1 1" To="0.2 0.2 0.6 0.6" Duration="0:0:4"
                                      Storyboard.TargetName="Viewbox1" Storyboard.TargetProperty="Viewbox"/>
                              <ab2d:RectAnimation To="0.5 0.4 0.2 0.2" BeginTime="0:0:4" Duration="0:0:4"
                                      Storyboard.TargetName="Viewbox1" Storyboard.TargetProperty="Viewbox"/>
                              <ab2d:RectAnimation To="0 0 1 1" BeginTime="0:0:8" Duration="0:0:2"
                                      Storyboard.TargetName="Viewbox1" Storyboard.TargetProperty="Viewbox"/>
                          </Storyboard>
                      </BeginStoryboard>
                  </EventTrigger.Actions>
              </EventTrigger>
          </Button.Triggers>
      </Button>  
      <ab2d:ViewboxEx Name="Viewbox1">
        <TextBlock>12345</TextBlock>
      </ab2d:ViewboxEx>
    </Grid>
</Window>
See Also