Hi,
I've used XamDataGrid with 4 unbound columns and each column has a CellvaluePresenter and I've 2 buttons ("Save" & "Close") on the same wpf window.
in grid, column 2 has been bound to an business object property and it has DropDown to change value.
I need to disable "Save" button, if any Cell in column 2 has no value(NULL).
in winforms it was easier to go through the cell values. but in WPF it is damn hard to find out where is this value.
can you please tell me an event or any other way to find out if any cell doesn't have a value?
I'm using MVVM pattern for development.
I would appreciate any help on this.
Thanks
If you have bound the column to an object property and you set the binding mode = two way,
you can simply check the values of the object properties. Thats the beauty of MVVM, you don't have to iterate through the cell collection of the grid.
i would also recommend to use a Command for your button. this way you can use a CanExecute method to enable/disable the button.
the problem is i cannot modify Business Object. I get List<Business object> which is bound to the grid correctly. in cellvalupresenter I've used validation rules to notify user if business object has invalid data.
there is also a mechanism provided to user to set values for business object through text boxes and dropdowns.
all i want to do is, disable the "Save" button if any value is wrong.
now tell me how you would do this with beauty of MVVM.