Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Zooming in Diagram (Read 2157 times)
Swagata
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 25th, 2012
Zooming in Diagram
Sep 25th, 2012 at 3:35am
Print Post  
How can I do zooming in diagram ?
Below is the code :
<ScrollViewer Margin="3" Grid.Row="0" x:Name="ScrollViewer" >
<mf:Diagram Name="diagram"
VerticalAlignment="Stretch"
HorizontalAlignment="Center"
BackBrush="White"
AllowDrop="False"
NodeClicked="DiagramNodeClicked"
AutoResize="AllDirections"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Center"
RestrictItemsToBounds="InsideOnly"
LinkEndsMovable="False"
IsEnabled="True"
IsManipulationEnabled="False"
AllowInplaceEdit="False"
RoundedLinks="True"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
/>
</ScrollViewer>

I cant use mousewheel event because our client does have scroll mouse
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Zooming in Diagram
Reply #1 - Sep 25th, 2012 at 6:15am
Print Post  
Hi,

For example, you could bind to the Diagram.ZoomFactor property (the example uses a Slider control):

Code
Select All
<Slider Value="{Binding ElementName=diagram, Path=ZoomFactor, Mode=TwoWay}"
    Minimum="40" Maximum="200" SmallChange="10" TickFrequency="10"
    TickPlacement="BottomRight" Width="100" />
 



or, you could handle a KeyUp/Down event to map the +/- keys to the Diagram zooming methods:

Code
Select All
private void Window_KeyUp(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Add || e.Key == Key.OemPlus)
        diagram.ZoomIn();
    else if (e.Key == Key.Subtract || e.Key == Key.OemMinus)
        diagram.ZoomOut();
}
 



I hope this helps.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Swagata
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 25th, 2012
Re: Zooming in Diagram
Reply #2 - Sep 25th, 2012 at 8:05am
Print Post  
Thanks..i used slider..it works
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint