Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic V2.3 & 2.4 Snap-scrolling Behaviour (Read 2162 times)
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
V2.3 & 2.4 Snap-scrolling Behaviour
Oct 15th, 2010 at 1:54pm
Print Post  
Hi

Getting some strange behaviour when the diagram resizes, in 2 scenarios, both where a diagram is contained within a scrollviewer.

1. Diagram.ResizeToFitItems() - causes the diagram to "snap-scroll" to the top left, effectively re-setting scrol bar values to 1

2. When resizing a control on the diagram, with the diagram set to automatically expand if its bounds are breached, the diagram will "snap-scroll" again to top left (but with the added inconvienience that this happens while the left mouse button is still depressed, causing the control being resized to be turned inside-out becuse the snap-scroll action has caused the pointer to be at a position that gives the control a negative height & width). The negative values are fine, the "snap-scroll" is the problem

I'm tying to replicate this in a stand alone project, but so far without success. Has anyone else experienced such behaviour?


Thanks

Paul Eden
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: V2.3 & 2.4 Snap-scrolling Behaviour
Reply #1 - Oct 15th, 2010 at 2:51pm
Print Post  
Hi,

Could you copy here the init code for the scroll viewer and the diagram - both Xaml markup and the code-behind?

Stoyan
  
Back to top
 
IP Logged
 
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Re: V2.3 & 2.4 Snap-scrolling Behaviour
Reply #2 - Oct 18th, 2010 at 10:26am
Print Post  
Hi

XAML:
<ScrollViewer Margin="0,0,5,7" Grid.Row="1" Height="Auto" Width="Auto" Focusable="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" d:LayoutOverrides="Width, Height">
<MF:Diagram x:Name="oHypothesisDiagram" ZoomFactor="100" Width="Auto" Height="Auto" MeasureUnit="WpfPoint" Bounds="0,0,640,480" NodesExpandable="False" Background="{DynamicResource FlowBGBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" AllowSelfLoops="False">
<MF:Diagram.LinkPen>
<Pen Brush="#FFFF7A08" Thickness="2"/>
</MF:Diagram.LinkPen>
</MF:Diagram>
</ScrollViewer>


Code Behind:
oHypothesisDiagram.Behavior = Behavior.Custom;
oHypothesisDiagram.CustomBehavior = new BehaviorEx(oHypothesisDiagram);

oHypothesisDiagram.AllowDrop = true;

oHypothesisDiagram.NodeCreating += new NodeValidationEventHandler(oHypothesisDiagram_NodeCreating);
oHypothesisDiagram.LinkCreated += new LinkEventHandler(oHypothesisDiagram_LinkCreated);
oHypothesisDiagram.TreeCollapsed += new NodeEventHandler(oHypothesisDiagram_TreeCollapsed);
oHypothesisDiagram.TreeExpanded += new NodeEventHandler(oHypothesisDiagram_TreeExpanded);
oHypothesisDiagram.NodeModified += new NodeEventHandler(oHypothesisDiagram_NodeModified);
oHypothesisDiagram.LinkDeleted += new LinkEventHandler(oHypothesisDiagram_LinkDeleted);
oHypothesisDiagram.LinkDeleting += new LinkValidationEventHandler(oHypothesisDiagram_LinkDeleting);
oHypothesisDiagram.Background = new SolidColorBrush(Colors.Transparent);
oHypothesisDiagram.RecursiveExpand = true;
oHypothesisDiagram.Clicked += new DiagramEventHandler(oHypothesisDiagram_Clicked);
oHypothesisDiagram.NodeDeleted += new NodeEventHandler(oHypothesisDiagram_NodeDeleted);
oHypothesisDiagram.NodeModifying += new NodeValidationEventHandler(oHypothesisDiagram_NodeModifying);
oHypothesisDiagram.DragEnter += new DragEventHandler(oHypothesisDiagram_DragEnter);
oHypothesisDiagram.Drop += new DragEventHandler(oHypothesisDiagram_Drop);
oHypothesisDiagram.NodeDeleting += new NodeValidationEventHandler(oHypothesisDiagram_NodeDeleting);
oHypothesisDiagram.SizeChanged += new SizeChangedEventHandler(oHypothesisDiagram_SizeChanged);
oHypothesisDiagram.ExpandButtonClicked += new NodeEventHandler(oHypothesisDiagram_ExpandButtonClicked);
oHypothesisDiagram.ExpandButtonAction = ExpandButtonAction.RaiseEvents;
oHypothesisDiagram.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, (sender, args) => { DiagramCopy(sender, args); }));
oHypothesisDiagram.CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, (sender, args) => { DiagramCut(sender, args); }));
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: V2.3 & 2.4 Snap-scrolling Behaviour
Reply #3 - Oct 18th, 2010 at 1:49pm
Print Post  
Hi,

1) This could happen if the new diagram.Bounds does not include the current scroll position anymore. In such case you might try saving ScrollX and ScrollY from before the ResizeToFit call and restoring them after that; I think the scrollbar should set its maximum value as scroll position if the new value happens to be larger than it.

2) I could not reproduce this. What does the NodeModifying event do? Also what kind of nodes are you using?

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint