Diagram_Loaded Event

Hi,

After the diagrams model is loaded I get the Diagram_Loaded event. If I later replace the model how do I know when the loading is completed. I need to make changes to a DataGrid inside a node(s) where I want to make use of the ActualWidth. This ActualWidth is not yet set when I reference it and therefore I crash. Do I need to wait on some event? I tried the ModelReplaced event but that did not help. How should I handle this?

Thanks
Rich

All of us are off for the holidays now, so I’m not sure we can answer your question at this time.

I don’t believe that “loading” a model causes a FrameworkElement.Loaded event, because those are different “construction processes”.

If you replace the value of Diagram.Model with a new model, I think you eventually get a different Diagram event: InitialLayoutCompleted. But at the moment I can’t check the documentation to make sure.

Hi,

I tried the “InitialLayoutCompleted” event. At that point the nodes ActualWidth is still set to 0.0. At what point is ActualWidth set and is there any other event or other means to let me know that the node had it’s ActualWidth set.

Thanks
Rich

Is that particular Node actually visible to the eye at the time you check its ActualWidth?

Also, have you tried using the value of Part.Bounds to get the width and/or height?

I don’t understand why you need the value of ActualWidth.

I tried the node.bound.width property and got the same result. The first time I set the model I get the Diagram_Loaded event and execute a function that uses the nodes width. OK so far. I have a menu item where a new model may be selected and on that event I replace the diagrams model. I then execute the same function that was executed from Diagram_Loaded event but in this case it fails ( the width is not yet set ). My assumption is that the actual loading of the new model is not finished and I need some event to tell me that the model has finished loading before referring to the node.bounds.width property.

Thanks
Rich

Are you saying that after you set Diagram.Model to a new model, and in your Diagram.InitialLayoutCompleted event handler, every Node.Bounds.Width is zero, even though you can see the Nodes?