Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Position top left when zooming out (Read 1517 times)
vanderpol
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Mar 19th, 2018
Position top left when zooming out
Mar 19th, 2018 at 1:01pm
Print Post  
When zooming out a diagram so that it will not fill the DiagramView area, I'd like to keep the position in the top left corner and not centered. Is this possible to achieve?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3448
Joined: Oct 19th, 2005
Re: Position top left when zooming out
Reply #1 - Mar 19th, 2018 at 4:50pm
Print Post  
You can achieve it by aligning the ScrollContentPresenter in custom template for the ScrollViewer / DiagramView:

Code
Select All
<diag:DiagramView>
    <diag:DiagramView.Style>
        <Style TargetType="{x:Type ScrollViewer}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollViewer}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Border Grid.Column="0" BorderThickness="0,1,1,1">
                                <ScrollContentPresenter
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top" />
                            </Border>
                            <ScrollBar x:Name="PART_VerticalScrollBar"
                                 Grid.Column="1"
                                 Value="{TemplateBinding VerticalOffset}"
                                 Maximum="{TemplateBinding ScrollableHeight}"
                                 ViewportSize="{TemplateBinding ViewportHeight}"
                                 Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                            <ScrollBar x:Name="PART_HorizontalScrollBar"
                                 Orientation="Horizontal"
                                 Grid.Row="1"
                                 Value="{TemplateBinding HorizontalOffset}"
                                 Maximum="{TemplateBinding ScrollableWidth}"
                                 ViewportSize="{TemplateBinding ViewportWidth}"
                                 Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </diag:DiagramView.Style>
    <diag:Diagram Bounds="0, 0, 100,100"  />
</diag:DiagramView> 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint