DataGrid with DataGridTemplateColumns - Cannot create new rows
-
I have a DataGrid with a couple of
DataGridTemplateColumns
. When I try to hit the Enter-key on my keyboard there is no new row created in the DataGrid. I have other DataGrids with columns which are notDataGridTemplateColumns
and I can then create new rows by hitting the Enter-key. So I assume theDataGridTemplateColumns
in some way causing the problem. I have made a reproducible code and I have made it public in this GIT-Gist. * I use Fody PropertyChanged to handle all the INotificationPropertyChanged in my view models. * The code should just be copy-and-paste. The bindings between the View and the ViewModels also don't seem to work :S But if you uncomment the row in the ViewModel's construcotor (please see line 60 in the MainWindow.xaml.cs), a new row in the DataGrid will be created. With this row, the bindings works as expected. I cannot understand why. Here is the XAML-code. It maybe enough for you with only the XAML-code to solve this problem. -
I have a DataGrid with a couple of
DataGridTemplateColumns
. When I try to hit the Enter-key on my keyboard there is no new row created in the DataGrid. I have other DataGrids with columns which are notDataGridTemplateColumns
and I can then create new rows by hitting the Enter-key. So I assume theDataGridTemplateColumns
in some way causing the problem. I have made a reproducible code and I have made it public in this GIT-Gist. * I use Fody PropertyChanged to handle all the INotificationPropertyChanged in my view models. * The code should just be copy-and-paste. The bindings between the View and the ViewModels also don't seem to work :S But if you uncomment the row in the ViewModel's construcotor (please see line 60 in the MainWindow.xaml.cs), a new row in the DataGrid will be created. With this row, the bindings works as expected. I cannot understand why. Here is the XAML-code. It maybe enough for you with only the XAML-code to solve this problem.Can't think of too many examples that use buttons and sliders in a data grid; data sources called "path" and "value"; and columns that are read-only. Worlds in collision.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Can't think of too many examples that use buttons and sliders in a data grid; data sources called "path" and "value"; and columns that are read-only. Worlds in collision.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
The code I gave, is only an example how to reproduce the problem. A real-life example of a button, textboxes and a slide is irrelevant. My actual code contains of a button, a textbox, two numeric up down controls and a date picker in each row. All columns, except the textbox, are DataGridTemplateColumns. Is there a solution to my problem?