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, I have a problem here with the diagram rendering. FYI, we are constructing FlowDiagramModel, and do the binding on the Diagram. We have a recursive build up on the DiagramNode models, which one time might add up to 200 nodes in a loop. So, at this time, the diagram will appear like 'freeze' and after awhile (3-5seconds) all the nodes appeared at once. So in order to make it more 'UI-Friendly', we would like to have a 'loading' animation being displayed when a lot of nodes are added and the diagram is 'freezing'. So, I was wondering is there an event for our usage for this purpose? |
|
|
There are no events on the diagram surface for this, but you should be able to achieve this without any. Before running the loop that adds 200 nodes, you could tell some kind of loading indicator visual to become visible. Then at the end of the loop, hide the loading indicator again. You may need to use Dispatchers with DispatcherPriority of ApplicationIdle to get this to work. Try this out and let me know how it goes. -Jason |
|
|
Hi, I think my problem is not really on the loop of adding 200 nodes, but after that. Means, when I add the 200nodes, the UI is not yet initialized, and the binding doesn't happen yet. So, on the start of the application, when the binding happens, the model already contains 200 nodes, and it will takes time for the Diagram to render the nodes. That is where the 'lag' comes in. |
|
|
Hello I think I have achieved a similar effect that your looking for by playing with the Dispatcher. First I added a loading indicator that overlays in the centre of the DiagramSurface. When a button is pressed, I set the visibility of the loading indicator to be visible. Then I use a Dispatcher with a DispatcherPriority of ApplicationIdle to call a method that changes the diagram. I used a delegate so I can pass in the diagram to switch to - based on which button was pressed. This will let the loading indicator be displayed before the diagram gets rendered. In the SetDiagram method, I set the Diagram property which the DiagramSurface is binding to. Then I do another Dispatcher call with DispatcherPriority=ApplicationIdle to call a method that hides the loading indicator. ApplicationIdle will means the method only gets called when the diagram has finished being rendered. I have attached a sample that demonstrates this. -Jason |
|
|
Hi, Thanks for your sample. I learn something from your dispatcher implementation. However, it seems to be taking way to long to renders. I remembered last time when i added 100objects, it's like 2-3seconds only, but right now it took like 6-7 seconds. Anyway, the effect is almost there, just that right now there is one thing which is not desirable: application is kind of 'not responding' if you want to click on it and drag the window around. :/ So still I think I need to try more on this to get it work smoothly somehow. By the way, I would like to know, is Diagram support Virtualizing? I mean UI Virtualizing like the WPF ListBox, where you can choose to only render what you can see on the view. Can I enable virtualizing on diagram so that it only renders those items on the viewport? |
|
|
Hello I also noticed that loading 100 nodes was taking a bit long with this dispatcher trick. You may need to experiment with using threads to get things working smoothly. At the moment the DiagramSurface does not use virtualization. This is something we will be looking at doing though. We are quite bogged down with work at the moment but I'll continue to investigate in areas that could improve the performance. A good tip for improving the performance is to simplify your node styles wherever possible. Try to cut down the number of visual elements that build up a node. Remove redundant grids and borders where possible. Hope this helps. |
|