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
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I suggest you use the following code in your XamDataGrid’s InitializeRecord event:
isEmpty = true; foreach (var item in xamDataGrid1.Records) { foreach (var subitem in (item as DataRecord).Cells) { if (subitem.Value == null) { isEmpty = false; return; } } }
And define an isEmpty Property of bool type for the Window and bind the Button’s IsEnabled property to it.
Feel free to write me if you have further questions.