WPF DataGrid Group Style Sorting
I have a data grid that groups on a TypeId. When ever data is entered i开发者_JS百科nto the fields it wants to sort the data in the Grouped area. I cannot seem to turn that feature off.
Are You asking about AllowSorting property of DataGrid ? Just set it at false and nobody can sort in dataGrid.
or Create column and set in it disable sorting like that
<dg:DataGrid ItemsSource="{StaticResource myData}"/> >
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Header="No." Width="SizeToCells"
Binding="{Binding CheckNumber}"
IsReadOnly="True"/>
<dg:DataGridTextColumn Header="Date"
Binding="{Binding Date, StringFormat=d}" />
<dg:DataGridTextColumn Header="Pay To" MinWidth="200"
Binding="{Binding Recipient}"
CanUserSort="False"/>
</dg:DataGrid.Columns>
</dg:DataGrid>
精彩评论