I am new to wpf; I am using editable comboBox (for search purposes).
When changing text in a ComboBox, the search result is displayed below the datagrid. When any row from a data file is selected, its values ββare displayed in text boxes for editing.
When I write something in combobox, the corresponding row is displayed in the data grid, but when I click to select a row, the application throws a nullreference exception .
My application worked correctly when the logic for updating the DataGrid data was behind the button.
Code for the "SelectionChange" DataGrid Event:
private void CategoryRowSelected(object sender, System.Windows.Controls.SelectedCellsChangedEventArgs e) { ClearForm(); if(CategoryDataGrid.SelectedItem!=null) { categoryMember = CategoryDataGrid.SelectedItem as CategoryTbl;
and code for the textChange event for ComboBox:
private void RefreshDataGrid(object sender, System.Windows.Controls.TextChangedEventArgs e) { CategoryDataGrid.SelectedIndex = -1;
source share