lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.13k stars 674 forks source link

WPF UI DataGrid Exception #498

Open KeesBL opened 1 year ago

KeesBL commented 1 year ago

Describe the bug

Sorting the data grid several times in quick succession will cause an exception: "System.InvalidOperationException: ''ContentControl' TargetType does not match type of element 'DataGridColumnFloatingHeader'.'" The issue isn't reproducible every time, but does happen consistently. A stack trace from the exception is attached.

WPF UI DataGrid Exception Stack Trace.txt

To Reproduce

Run Wpf.Ui.Demo and switch to the Data page. Scroll to the WPF UI DataGrid. Click the headers quickly, the exception happens pretty reliably for me within about 15 seconds.

Expected behavior

I'd expect the control to be able to be sorted quickly without raising an exception that crashes the program.

Screenshots

No response

OS version

Windows 11 Enterprise 22H2, 22621.1105

.NET version

.NET 7.0

WPF-UI NuGet version

2.0.3

Additional context

No response

KeesBL commented 1 year ago

An update: the exception (System.InvalidOperationException: ''ContentControl' TargetType does not match type of element 'DataGridColumnFloatingHeader'.') occurs reliably when dragging DataGrid or WPF UI DataGrid columns to reorder them.

abdullahhhkeskinn commented 1 year ago

Hey I am facing the same issue, Were you able to find any solution or disable reordering ?

KeesBL commented 1 year ago

Setting CanUserReorderColumns to False disables the behavior, but of course also disables users' ability to reorder their grids. Hopefully a temporary fix!

AndreasKleinb commented 1 year ago

I have the same error. Hope it can be fixed soon :)

ss3ui0k commented 9 months ago

I have fixed it,https://github.com/MahApps/MahApps.Metro/issues/1315

just set a style for datagrid @KeesBL @AndreasKleinb