Binding on new node

Hello,

First I need to explain my code structure :

Assume “MyNode” is my Node.Data class.
In MyNode
I have a field : WeakReference _wr_myfield;
a property : MyStruct MyField

This field reference my internal structure “MyStruct”, which contains a color. (with Propertychange notification)

Well, in the node datatemplate I bind some border background with the myfield color.
Somewhere in my application I have an interface to modifiy Mystruct.Color.

My problem is that when I change the color for a node readed during the initialisation, all is ok, the binding is good.

But when I’d like to do the same for a node creating in the session (from a palette or with double-click) the new color is not setting until I change my envireonnement, saying I unload my user-control (change to an other view) and come back to the diagram view.
Now all is ok, also for the new node.

Have you an idea ?

I don’t think that the weakreference is the trouble, I tried to remove it and point directly to MyStruct.

Thanks
Aurore

Based on how I think data-binding is implemented, I would guess that implementing INotifyPropertyChanged won’t work for structs.

Hello,

It’s not due to structs (because I don’t use them)

I made a new test.

My datatemplate was structured like this :

   <datatemplate >
        <go:SpotPanel...>
               <ViewBox>
                     [.. some pretty figure ...]
               </viewbox>
               <Control style={binding predefinedstyle} />
        </go:SpotPanel>
   </datatemplate>

And the suprizing thing is that I use the same multibinding to define the color of the first view box and for a rectangle in the control.
Then, the color in the rectangle was ok, not for the viewbox.

I’ve then change a little my structure :

   <datatemplate >
        <go:SpotPanel...>
               <Control style={binding predefinedstyle} />
        </go:SpotPanel>
   </datatemplate>

the viewbox is now in the predefinedstyle for control.
And now color is well binding… (but I loose my desired width and height…)

It doesn’t matter I will found a solution now I’ve made color works !

Maybe I should test your latest build, it’s perhaps related to this change :
“WPF: Fixed Part.IsVisibleElement to handle non-UIElement Visuals
in the visual tree”

Thanks
Aurore

Yes, the latest build fixes the problem you reported regarding ViewBoxes and hit-testing and related issues.

But I don’t think it would change anything to do with data-binding scopes.

You’re right, it does nothing for data-binding troubles Wacko