Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
enable/disable button on any Gird cell value if empty/null
posted

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

Parents
No Data
Reply
  • 85
    posted

    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.

Children