wpftoolkit icon indicating copy to clipboard operation
wpftoolkit copied to clipboard

AvalonDock: sometimes Content with DataGrid becomes null and reloads

Open makorobeynikov opened this issue 5 years ago • 2 comments

Hello, I am having difficulty using AvalonDock control, which is part of Extended.Wpf.Toolkit version 3.8.1. I put DataGrid in content of LayoutAnchorable tab. And I can't use filtering for DataGrid, because Content is reset at some time moment and reloaded. Then any filter loses DataGrid and throws error. I tried to connect two column filtering options to DataGrid located inside AvalonDock, namely DataGridExtensions and AutoFilterDataGrid. I am attaching test projects running under Win10.

AvalonDockWithFilterDataGrid.zip

DataGridExtensions breaks when reconnecting via RDP during program execution: "System.InvalidOperationException: 'DataGridFilterColumnControl must be a child element of a DataGridColumnHeader.'" AutoFilterDataGrid throws error when starting program: "System.NullReferenceException: 'Object reference not set to an instance of an object.'" If you place DataGrid with filtering outside of AvalonDock, right in Window, then these errors do not appear for both filters. It turns out that there are places in code that overwrite and reload Content when there seems to be no need to do this.

How can I prevent reloading of Content?

makorobeynikov avatar Apr 15 '20 10:04 makorobeynikov

Hi,

I'm not sure what the AutoFilterDataGrid does, but the NullRefException comes from the AutoFilterDataGrid.dll. Replacing the "afdg:AutoFilterDataGrid" in xaml by the default "DataGrid" do not throw NullRefException.

For DataGridExtension, I don't see any exceptions. It shows well and filters correctly.

Can you provide a sample with the default DataGrid, showing how you filter and when the data is reloaded, causing errors while used in AvalonDock ?

Thank you.

XceedBoucherS avatar Apr 20 '20 15:04 XceedBoucherS

I ran into the same issue. I updated DatagridExtensions to 2.5.1. Now it's working.

NormanKoerber avatar May 05 '21 06:05 NormanKoerber