Rob,
Yes, it is an observable collection. All setters raise propertychanged events. The collection is an array of an class that contains fields/titles that are bound to the view. No problem with the binding and getting events back to the detail class. All our xaml is dynamic and there is no code behind!
Let me map it out.
DC = Detail class with properties for field title/field value (and other stuff, including a class that has an observable collection in it for itemlist population)
(I use array and collection meaning the same thing, an observable collection.)
VM View Model, it has a property that is an array of the DC class. VM has properties that control other aspects of the view such as being able to save, change rows in a datagrid.
V View This has a section bound to the VM that has a datagrid and a grid representing the selected row in the datagrid.
The grid labels/textboxes and other controls are bound to the dc[x] properties.
What I need to understand is when I change dc[1]'s value, I need to check in the setter if the value passed is different than the original value in the dc array element and if so, set another property to indicate that. Then what I want is to have the VM know to execute a routine to check the indicator property for all rows in the array and set or clear a flag on the VM to indicate that the detail is different. I will then use this flag in xaml controls to determine if I need to change the display. I do not want xaml always checking through the children, only when a change occurs should the children be checked, so the xaml event to determine things will only look at the single VM property. It turns out that in the itemlist object, I have properties/events bound to the xaml that are based solely on that individual itemlist, and when certain events happen such as a repopulation of the itemlist's collection, I need to let the DC know about it and it may notify the VM about it too.
I have seen example with people using their own frameworks and stuff, but not something straightforward in VB where I can grasp what is happening and how to utilize it with the different possible scenarios. Overriding is possible, but I need it clearly explained, as I am a noob!
I am looking for something where the detail class would not have to know specifically about its parent class.
Brian
Rob Said:
Is this an ObservableCollection?
Are you raising the PropertyChanged event for each property on the class that implement the INotifyPropertyChanged interface?
If you are doing these, then it should be simple enough to wire up events in your property handlers for each row in the collection.
Not 100% sure of your layout but you should be able to bind to those specific UI properties that would change when values change in the collection. You are not restricted to just binding to data display values. You might want to create some IValueConverters that look at your internal data and then return values applicable to a UI setting such as enabled/disabled or visible/hidden type of stuff. |