Reputation: 7303
How can I implement a zoom control to my wpf forms similar to the one avaialble in the visual studio designer?
thanks!
Upvotes: 18
Views: 13879
Reputation: 119
To get a professional Zoom Control for WPF check out the ZoomPanel.
It is not free, but is very easy to use and has many features - animated zooming and panning, support for ScrollViewer, mouse wheel support, included ZoomController (with move, zoom in, zoom out, rectangle zoom, reset buttons). It also comes with many code samples.
Upvotes: 1
Reputation: 22744
Put your stuff into a grid, bind the grid's scale render transformation to a slider (slider should have min value of 1):
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="0.867*"/>
<RowDefinition Height="0.133*"/>
</Grid.RowDefinitions>
<Slider x:Name="slider" Grid.Row="1" Minimum="1"/>
<Grid RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform
ScaleY="{Binding Path=Value, ElementName=slider}"
ScaleX="{Binding Path=Value, ElementName=slider}"/>
</TransformGroup>
</Grid.RenderTransform>
<TextBox Text="TextBox" Height="45.214"
VerticalAlignment="Top" Margin="194,139,209,0"/>
<TextBox VerticalAlignment="Bottom"
Text="TextBox" Margin="194,0,209,118.254" Height="48.96"/>
</Grid>
</Grid>
Upvotes: 25
Reputation: 2112
Maybe you could try out the Zoom Control which is part of WPF Extensions available on Codeplex:
Upvotes: 5
Reputation: 292405
You should have a look at this article by Mitsu Furuta (don't worry about the funny title !). I'm not sure whether it meets your requirements exactly, but it could give you some ideas...
Upvotes: 1