OnUnknownPropertyChanged and TreeViews (wpf)

OnUnknownPropertyChanged and TreeViews (wpf)

Old forum URL: forums.lhotka.net/forums/t/6495.aspx


Oob posted on Monday, February 23, 2009

I have a TreeView that is bound to a list of business objects. Each business object has a list of 0 to many child objects. The WPF TreeView can be data bound pretty easy.

Here is the problem, When the partent list or any child list becomes dirty, the TreeView is reset. Meaning that all root nodes are collapsed.

I have norrowed it down to the fact that MarkDirty() calls OnUnknownPropertyChanged(). This fires a OnPropertyChange for an empty string. That is translated by .NET as a Reset.

Quote From MSDN: http://msdn.microsoft.com/en-us/library/system.componentmodel.propertychangedeventargs.propertychangedeventargs.aspx
An Empty value or  null reference (Nothing in Visual Basic) for the propertyName parameter indicates that all of the properties have changed.

This reset is what causes the TreeView to collapse when it shouldn't.

I have two questions.
-Why does MarkDirty() what a reset to be fired in the first place?
-Is this still valid with CSLA 3.6 and WPF? Because I can override OnUnknownPropertyChanged() to do nothing and my UI "seems" to work fine. However I do not know what I could have broken under the covers.

Thank you
Tony



Oob replied on Tuesday, February 24, 2009

Well with the lack of responses, I assumed I was wrong. As it turns out I am. :).

I made a test app that does what I thought was the problem and it is not affected by the above problem. Which means that the problem exists somewhere in the code base I am working.

The test app can add, removing, change an items anywhere in the treeview works just fine as far as I can tell.


Copyright (c) Marimer LLC