In my C# wpf application i have taken a DataGrid which is bounded by a datatable from database. All values are displayed in this DataGrid. But i want to get the selected cell value.
Here is my code which is bounded by datatable:
dataGrid1.ItemsSource = datatable1.DefaultView;
Please give me a solution to find the cell value. I have found selected index by following code:
dataGrid1.SelectedIndex
Assuming that you are editing a DataGridTextColumn cell...
Use e which is in the dataGrid1_CellEditEndingEvent like so:
((TextBox)e.EditingElement).Text
This will give you the typed text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With