when i try to submit a Cell Value on a WPFDataGrid to the database, somehow the database query code is working fine, and the database is updated successfully. but then afterwards the Application crushes and the Debugger doesn’t highlight any code at all.
I looked around the internet but couldn’t find any helpful resources at all. Can anyone who had dealt with similar case to please explain what is the issue behind that error, and how can i solve it.
That means you’ve Overridden your DataGrid Cell Template (somehow) and the new Template is messing out the Edit-ability of your Cells.
I suggest that you check these:
Check that you didn’t override the default Cell Template, in case you did make sure that your new Cell Template implements it in a way similar to the default one. especially when it comes to the edit-ability feature and its data/template bindings (notice that the default Cell Template uses a TextBox as the editing zone).
In case you are using some 3rd Party UI Library or Themes, make sure that they aren’t replacing your default DataGridCell Template, Poorly written libraries can cause that with broken Bindings or Wrongly implemented Cell Templates.
Finally; It can be really easy to edit your DataGridCell Template by just using the tools provided by Visual Studio itself. Follow these easy steps to:
Right-Click your Control on the Designer.
Click the Menu Item Under “Edit Additional Templates” > “Edit Cell Style” > “Edit a Copy…”.
Fill in the Style name and where you want it to be placed (e.g. App.xaml, a Theme Resources Dictionary or within the current file…etc).
That should be enough to generate a new XAML Style for your DataGridCell, go and Modify its Template.