Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Applying margin to diagram in a new version. (Read 213 times)
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Applying margin to diagram in a new version.
Nov 26th, 2024 at 12:10pm
Print Post  
Hello, MindFusion team!
Thank you for your efforts in helping transition to the new version of the charts. In the previous version it was easy to apply margin on diagram, but in newer it is not possible, as Diagram is not visual element anymore. I've tried setting margin property to DiagramView, but its actual bounds are located only within current viewport, so margin is applied to every side, no matter if there is scrollable content or not. What class should I modify to keep margin logic from the previous version?
  

V0yr7mFMwa.png ( 53 KB | 13 Downloads )
V0yr7mFMwa.png
oGrw5cXoCp.png ( 64 KB | 12 Downloads )
oGrw5cXoCp.png
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: Applying margin to diagram in a new version.
Reply #1 - Nov 26th, 2024 at 12:11pm
Print Post  
Attached projects:
  

ApplyMarginNewVersion.zip ( 437 KB | 41 Downloads )
ApplyMarginOldVersion.zip ( 436 KB | 12 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Applying margin to diagram in a new version.
Reply #2 - Nov 26th, 2024 at 2:32pm
Print Post  
Try applying margins to the DiagramPresenter, by customizing diagram view's Xaml template:

Code
Select All
<mindfusion:Ruler
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch">

    <mindfusion:DiagramView
        x:Name="DiagramView"
        HorizontalContentAlignment="Center">

        <mindfusion:DiagramView.Template>
            <ControlTemplate TargetType="{x:Type mindfusion:DiagramView}">

                <ScrollViewer
                    x:Name="PART_ScrollViewer"
                    CanContentScroll="True"
                    HorizontalScrollBarVisibility="Auto"
                    Focusable="False">

                    <mindfusion:DiagramPresenter
                        x:Name="PART_Presenter"
                        Margin="64"
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                </ScrollViewer>

            </ControlTemplate>

        </mindfusion:DiagramView.Template>
    </mindfusion:DiagramView>
</mindfusion:Ruler> 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: Applying margin to diagram in a new version.
Reply #3 - Nov 28th, 2024 at 10:13am
Print Post  
Yeah, that approach helped me, thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint