Inheriting WPF DataGrid might cause defaulting to OneTime databinding

I just ran into an annoying issue. I am extending WPF DataGrid copy and paste functionality similar to what is suggested by Vincent Sibal here.

public BetterDataGrid : DataGrid {…}

But when I did, data binding only worked against my initial view model. In my case a file load operation replaced the original view model and binding did not happen against the new view model.

I had to explicitly include Mode=TwoWay on the Binding, when using <this:BetterDataGrid … but this was not necessary when using <toolkit:Datagrid.

Just a warning, if you are going to extend DataGrid, be sure to explicitly set your binding mode.