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
|
I created a simple diagram. I try to scroll it to the right (or left). The size of the slider is reduced and I can scroll indefinitely. I don't want this behavior. How do I make scrolling does not go beyond the initial diagram? |
|
|
Hello I have included an AllowInfiniteScrolling property on the DiagramSurface. Setting this to false will prevent the scroll bars from scrolling indefinitely. This can be downloaded through the next nightly builds (available from around 1200 GMT). Let us know how it goes. -Jason |
|
|
Sorry for 'hijacking' your thread, but I think my question also kind of related. :P Is there an easier way to set, for example: User is only allowed to drag/scroll horizontally / vertically? This will be useful if we kind of creating a simple flows that user can only add nodes next/previous to the current one, and they won't be able to drag/create something not inline. (A bit like timeline control) |
|
|
You can set the Horizontal/VerticalScrollBarVisibility properties on the DiagramSurface to disable or hide the scroll bars. Will this work for you? -Jason |
|
|
This will only hide the scrollbars but not limiting them. Especially when you have dragging mechanism. (for example) They should only be able to drag horizontally but not vertically. |
|
|
oh, do you mean limit how a user can drag a diagram node? |
|
|
Not really. In my case, my diagram is being enabled with DragAction = "Pan", so in this case, if we want to limit the user to only pan horizontally (like in a timeline kind of control), then Scrollbar visibility is no longer applicable. |
|
|
ok, I'll look into adding an option for this and get back to you when it's ready. -Jason |
|
|
Thank you, Jason. AllowInfiniteScrolling="False" is working. |
|
|
Hi, while waiting for your updates on the scrolling disabling feature, I tried some POC to see whether diagram is usable for some of our custom control or not, here I have some problem on the diagram related to scrolling as well as others:
|
|
|
And, one more thing regarding the diagram: How can I disable the marquee selection if I don't need it? |
|
|
Hello Just letting you know I will be looking into these items now. -Jason |
|
|
Hello, here are my thoughts on these issues:
As for the marquee drag, you can disable this by setting The DragAction to Pan. Let me know if you want both marquee select and panning to be disabled. Handy tip (if you haven't already planned this): I noticed that your preview nodes are styled with a nested diagram surface (which is how I would do it). Here you are using the same node styles for the preview surface as the main surface. As a result, the nodes in the preview surface contain sliders and button controls (which you can actually press if you click carefully). This will slow things down with larger diagrams because instantiating a new control such as a button can be expensive when there are lots of them. I recommend that you use different node styles for the nested diagram. These nodes style can be far more simple than the main nodes styles. They won't need the buttons or sliders, and they don't really even need that many TextBlocks. Just a simple preview graphic that looks roughly like what you currently have Let me know how you go with these suggestions, and remember to get the next nightly build for issue 2 and 4. I have attached a modified version of your POC so you can see the changes I made. -Jason |
|
|
Hi Jason, I would say this is really nice. Thanks for your effort helping me out with this. Anyway, here are a few things I notice:
2 & 4, Yes, your events and the nodes work just as expected. Really cool. Thanks.
Overall, you did save my days. And guess what, we just decided to renew the Diagram license for our team due to the customizations that we can achieve on the Diagram. ;) I believe I'll need more of your help on actual implementation if I face any problem on virtualization. Thanks. Thanks. |
|
|
Hello, This is great to hear! I have seen the CPU load now. It seems to happen no matter where I pan the diagram, though the application itself still runs smoothly at my end. I have followed the code paths and we are doing fairly simple operations to pan the viewport. It could be due to code in the WPF ScrollViewer coupled with many mouse events causing all the panning operations. We can't do much about this at the moment, but virtualization should help this a bit. We are certainly planning to look into UI virtualization in the future. Even when we include virtualization, recycling the Empty nodes will continue to boost the performance. I understand why you want to disable the marquee select now, here are 2 quick possible ways you can do this:
Try these out and let me know if any of them are sufficient to disabling marquee drag. -Jason |
|
|
Hi, Thanks for the quick feedback and advice. 1 & 2 should work for me now. Thanks! I am kind of trying out the virtualization already, I have a question regarding the scrollviewer on the diagram since it imposes quite some calculation on the panning operations. Looks like I need a mechanism to make sure I got the Window size / ScrollViewer size first, before I can perform my calculation to determine how many nodes that are needed to be created and displayed on the diagram. So, is the current ds.Loaded event + ds.ViewPortChanged event good enough for this? I notice that I'll always need to check the Scrollviewer != null, so that it won't throw exception when it is not yet being initialized. I was curious is there an actual event for ScrollViewer, that being raised whenever it is being initialized? A very common scenario that will causes problem would be for eg: I have TabControl, Diagram is on Tab1, other stuff on Tab2, whenever you switch from Tab2 to Tab1, the OnLoaded event will fire, and do again the initialization, which is not desire. Any idea? |
|
|
There is no event for when the ScrollViewer is initialized. It is initialized when the DiagramSurface is rendered. I tried removing the null check from the OnDiagramViewPortChanged method in your POC, and the application operated fine. I have also included a check in the diagramming framework to ensure that ViewPortChanged can only be raised if the scroll viewer is initialized. This check will be in the next nightly builds which would be worth downloading. ds.ViewPortChanged will be the most useful event for implementing the EmptyNode virtualization. If you only need the diagram to be initialized once on the Loaded event, you could use a boolean flag to check if you have already initialized the diagram and then never initialize it again. Hope this helps, let me know if you need more advice. |
|