I am trying to get my head around the wpf way of doing things, as well as being a bit of a newbee on CSLA 4, so please excuse me.
I have a DatagridCheckBoxColumn bound to a boolean property in a CSLA editable child object. I am trying to trap when the user changes the checked status of the checkbox (with either mouse or spacebar - the old "Click" event), but there is no click event on the checkbox column, nor the datagrid. So I figure I should be reacting to changes in the bound object, rather than the UI. So I try to tap into the PropertyChanged event but notice that this is protected and not accessable in the wpf window class (different assembly).
I simply want the form to do something when the user changes the checked status, or the business object property changes. Can anyone point me in the right direction please?
Ta,
Perry
You can access the OnPropertyChanged (and other events) by casting the object to the actual Interface.
Here is how Csla.Xaml.ViewModelBase ataches itelf to a BO (here newValue):
// hook events on new value
if (newValue != null)
{
var npc = newValue as INotifyPropertyChanged;
if (npc != null)
npc.PropertyChanged += Model_PropertyChanged;
var ncc = newValue as INotifyChildChanged;
if (ncc != null)
ncc.ChildChanged += Model_ChildChanged;
var nb = newValue as INotifyBusy;
if (nb != null)
nb.BusyChanged += Model_BusyChanged;
var cc = newValue as INotifyCollectionChanged;
if (cc != null)
cc.CollectionChanged += Model_CollectionChanged;
}
Copyright (c) Marimer LLC