WPF DataGrid, application crash when adding a row

前端 未结 6 1770
青春惊慌失措
青春惊慌失措 2021-02-08 02:29

I have a wpf datagrid bound to a TrackableCollection. In some rare occations, and for only a few selected users, the application will crash when the user adds a new record by en

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-08 02:53

    No need for converters or for using a derived class. Just make sure that the property you are binding to for SelectedItem is initialized with DependencyProperty.UnsetValue. Do not set it to or leave it at the default of null.

    The underlying bug should be fixed in the not-too-far future, btw: https://developercommunity.visualstudio.com/content/problem/575165/vs-1604-ide-crash-argumentnullexception.html

提交回复
热议问题