|
Ability to Rotate the image
|
|
02-20-2010, 07:19 PM
(This post was last modified: 02-20-2010 07:48 PM by JimB.)
Post: #1
|
|||
|
|||
|
Ability to Rotate the image
Hello, I'm just starting to integrate the control into my application and need the ability to rotate. Has someone done this yet? I need to know the outline of where to add the Transform code to make this happen. I've got all the properties mapped to the panel so my appliciation would call it like this:
// Rotate the image indexImgZoomPanel.Rotate(intRotateAngle); I'm just not sure where in the DLL to add code that would actually do the rotation. I tried adding code in here but it didn't work: private Transform GetViewboxTransform thanks, Jim |
|||
|
02-22-2010, 10:08 PM
Post: #2
|
|||
|
|||
|
RE: Ability to Rotate the image
Rotation can be added to ZoomPanel and ViewboxEx with the following code change (this can be only done if you have purchased ZoomPanel with source code).
First you need to add Rotate DependencyProperty to ViewboxEx. Add the following before the constructor: Code: public static readonly DependencyProperty RotateProperty = DependencyProperty.Register("Rotate", typeof(double), typeof(ViewboxEx), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure));Now you have to change the GetViewboxTransform method (as you have correctly found out). After "transformGroup = new TransformGroup();" add the following: Code: if (this.Rotate != 0)Note that this line rotates the content of the ViewboxEx around the center of the ViewboxEx control. It can be rotated by simply changing the Rotate property. Now we need to add the Rotate property to ZoomPanel as well: Add the following before ZoomPanel constructor: Code: public static readonly DependencyProperty RotateProperty = DependencyProperty.Register("Rotate", typeof(double), typeof(ZoomPanel), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure));You also need to change the template for the ZoomPanel - change the Generic.xaml in Themes folder. The line 12 should look like: Code: <local:ViewboxEx Name="PART_ZoomViewboxEx" Stretch="Uniform" Rotate="{TemplateBinding Rotate}">The Rotate property of ViewboxEx was binded to the ZoomPanel Rotate property. That is it ![]() Now also ZoomPanel has a Rotate property that can rotate its content. You can simply test this by adding a Slider to the ZoomPanelSample.xaml: Add the following into the top right StackPanel: Code: <Slider Name="RotateSlider" Minimum="0" Maximum="360" Value="0" Width="160"/>Now you can bind the slider to the ZoomPanel with adding the following attribute to the ZoomPanel: Rotate="{Binding ElementName=RotateSlider, Path=Value}" |
|||
|
02-22-2010, 10:12 PM
Post: #3
|
|||
|
|||
|
RE: Ability to Rotate the image
Perfect, that's what I needed, thank you so much
|
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help



