0

I'm trying to intercept the WPF datagrid's event for adding a new item. I need to set some properties on the data object which is inserted into the datasource. Is there a way I can do this?

Echilon
  • 10,064
  • 33
  • 131
  • 217

2 Answers2

1

There isn't an event you can intercept. But you can probably do what you need with BindingList<T>. See this How to use a factory for DataGrid.CanUserAddRows = true

Community
  • 1
  • 1
Phil
  • 42,255
  • 9
  • 100
  • 100
0

I solved this by binding to an ObservableCollection<T>, then using the CollectionChanged event.

Echilon
  • 10,064
  • 33
  • 131
  • 217