I have a user control that contains a WPF toolkit DataGrid
. This control is used in many different places in my app. The grid has no knowledge as to the type of data that will show. Is there a way to initially sort the grid by the first column in ascending order no matter what data the grid is populated with? I don't think I can use a CollectionViewSource
because I don't know the PropertyName
of the property bound to the first column.
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
You could hook to an event:
and sort the first column:
I would suggest you to create a derived separate
DataGrid
control, placing this logic there and using the new control to avoid repeating the code every time.