Link disappear while data change in template model

Hello,

I have issues with links. In our project we use WPF and MVVM pattern. I use templates for nodes and links. When I change some properties in link model, often the link disappears.
If I manually invoke Remeasure() method on link, it shows up, but this is not the way how it should work in MVVM pattern. There is similar problem with link labels, data refresh id posible only with Remeasure method, not just through model change.
I attached sample video that shows the problem. I would be grateful if You would sugest some solution.

I attached also sample application, that presents the problem.
Here is link.

Let me know if I could provide more information.

Jack

Are you performing the changes within a GoXam transaction?

Thank You for replay.

I have found the tip with transaction in other thread, but it makes no difference. I have tried to start and commit transaction directly on Diagram (code behind) and on IDiagramModel. I have tried to commit and rollback transactions. No change. Any other things I can try?

I have never seen any problems like that, so I need help reproducing the problem.

What abut the link I have attached? This is Visual Studio 2015 project that reproduces the roblem. Will You be able to run it? It would be the best solution, because You would run the project in debugger. If no, I can prepare the most simple source code that produces the issue and give You as source files. On maybe I could prepare project in other development environment?

Sorry – I missed the link. I’ll look at it when I get to work.

You’re right – conducting a transaction does not help. I assume the state changes are meant to be transient.

Here is one way to change your code to call Remeasure() on each Node and Link after changing a bunch of data properties:

        private void OnChange(object sender, EventArgs eventArgs)
        {
            PlanModel.Links.ForEach(a =>
            {
                a.Update(_r.Next(1, 3) == 1);
            });
            var e = new ModelChangedEventArgs();
            e.Model = Model;
            e.Change = ModelChange.FinishedRedo;
            Model.RaiseChanged(e);
        }

Works great with test application. Thank You! Tommorow I will check that solution on production system and I will give you feedback.

Works OK. Hovewer, datachanges are fast sometimes. So, if there are many items in model, the performance is drastically decreased. But after some optimizations, it is usable.
You said that Your solution raises Remeasure on each node and link, no matter if it is needed or not. I suppose that this is the reason for performance issues. Is this final solution, or we can expect some internal fixes in future releases, that would not need manual Remeasure invokes?

We should have some sort of option so that Links get remeasured and rearranged automatically, asynchronously. I would rather not make that the default behavior, though, since that would slow down all apps. But then you wouldn’t have to use the work-around that I just provided. This will require some investigation and consideration before we implement anything.

This issue is addressed in version 2.2.2, which we released today.