This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Currently we faced an issue whenever user do some panning on the diagram, switch to different Diagram, do some more panning, and switch back to the previous diagram, the viewPort (panning) messed up. This might be due to the reason we have only one DiagramSurface control which binds to different FlowDiagramModel, but the viewport / panning information on the current diagram's is not being captured / saved in the FlowDiagramModel. I tried GetViewPort on every DiagramViewPortChanged, and set it to a properties in our FlowDiagramModel, and then on every DataContextChanged, use ds.SetViewPort to set it back, but it seems to be not working. Do you have any idea how to save the state of panning on every diagram? Thanks |
|
|
Hello The approach that you are using sounds like the best way to do it. I would recommend using the DiagramSurface.ScrollViewer.TranslateViewPort method when changing the diagram. Here you need to pass in how far to move the viewport horizontally and vertically. Let us know if this is not going to work for you. -Jason |
|
|
Yea, it's not working properly I am not sure why. After I call TranslateViewPort(), the viewport doesn't change. It works previously, and I think I didn't change any code related to that. |
|
|
Hello I have attached a sample that demonstrates what you have described. As the viewport is being changed, the viewport is saved in the code behind. Then when the diagram is switched, the appropriate viewport is restored. Make sure to include a reference to you WPF elements dll to run the sample. If this sample does not help you uncover the issue in your application, please send us a repro so I can look into it further. Let me know if you have any questions about the sample. -Jason |
|
|
Hi, thanks for your sample. I finally managed to find out the problems, there are two:
Question is, I need both of these features for: 1. Limiting the level of zoom for each diagram. 2. User can drag nodes across the viewport and it will auto pan. How to enable both of these and still able to restore the viewport correctly? |
|
|
Hello Thanks for this information. You can solve the issue caused by the smart scrolling by first setting the DiagramSurface IsSmartScrollingEnabled property to false just before you are about to change the viewport. Then, use a dispatcher after setting the viewport to set the IsSmartScrollingEnabled back to true. Not a terribly elegant solution, but it works well in the repro I made. Here is some example code of this:
As for binding to the zoom slider, I have not been able to reproduce any issues with this. Do you change the minimum and maximum slider values when you change diagrams? Or maybe there is some other logic or operation causing the slider issues? -Jason |
|