I have a WPF DataGrid which has a DataTable as its ItemsSource. The grid is meant to be used for only double values. However, for some cells no data is specified so the value can be null. (Actually the type is DBNull). This all works fine until I start editing a cell and then decide I don’t want any values in that cell and then try to leave it empty and continue. The DataGrid does not let me do this. How can I get it to work in a way so I’ll be able to reset the initial null value to a cell if I want?
I have a WPF DataGrid which has a DataTable as its ItemsSource . The
Share
You have to use a Value Converter…so you can set the value to DBNull if the cell is empty.
But I think you have to define columns manually…
in xaml:
your converter class has to implement the
IValueConverterinterface