ObservableCollection is not updating Multibinding in C# WPF?

The best way to do (only if your EntityAttrib and GameNode are two different classes inherited from same base class) would be actually defining two data templates as below erarchicalDataTemplate DataType="{x:Type local:GameNode}"> Since multibinding will not detect collection change event at all unless the reference/instance of collection changes. When you change an item in collection your actual instance of attributes/properties remains same When you bind ItemsSource = collection, its the ItemsSource that will listen for CollectionChange event and update the items accordingly.

The best way to do (only if your EntityAttrib and GameNode are two different classes inherited from same base class) would be actually defining two data templates as below. This is better because its easier to recollect later on. Consider file system objects, both FileInfo and DirectoryInfo classes are actually derived from FileSystemInfo class which shares common property.

You should have a baseclass, "BaseGameNode" , have something in it, "GameNode" and "GameEntityAttribNode" both derived from "BaseGameNode". And they should have only one Children property that is observable collection of type BaseGameNode but its item instance should be different as needed. You can define multiple templates provided they have something to distinguish, the type will be automatically chosen for the children of the node.

Value you have bound will not refresh because they are not dependency property neither they notify on change. Since multibinding will not detect collection change event at all unless the reference/instance of collection changes. When you change an item in collection your actual instance of attributes/properties remains same.

When you bind ItemsSource = collection, its the ItemsSource that will listen for CollectionChange event and update the items accordingly.

I don't understand how this helps. I will still have the same problem with multibinding. I actually do have a erarchicalDataTemplate for the EntityAttrib type to display them in a different color.

– user175396 Sep 18 '09 at 8:49 Your converter will not get called 2nd time at all, because it will only be called when the node is created. Because your multibinding will not detect change inside the observable collection, but its the ItemsSource that will detect collection change and refresh itself. – Akash Kava Sep 18 '09 at 8:53 Maybe I'm stupid, but I don't understand this.

I'm not changing something in a GameNode, I'm adding a GameNode to a collection, so the collection is changed and should send an event. You said the ItemsSource listens for CollectionChange, but the ItemsSource is the MultiBind which in turn is the collections. – user175396 Sep 18 '09 at 10:04 Yes ItemsSource listens for event but your converter only gets called if Attributes or ChildNodes instances change, not when they fire an event of collection change.

– Akash Kava Sep 18 '09 at 10:28 What do you mean with "if Attributes or ChildNodes instances change"? Doesn't adding an item change them or do you mean that I change them to an entirely different collection object? I tried making GameNode a INotifyPropertyChanged and manually fire OnPropertyChange("ChildNodes") after I added a new GameNode to ChildNodes.

That did call my converter and updated the TreeView. – user175396 Sep 18 '09 at 11:54.

Since multibinding will not detect collection change event at all unless the reference/instance of collection changes. When you change an item in collection your actual instance of attributes/properties remains same. When you bind ItemsSource = collection, its the ItemsSource that will listen for CollectionChange event and update the items accordingly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions