开发者

WPF DataGrid Group Style Sorting

开发者 https://www.devze.com 2022-12-23 12:49 出处:网络
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

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消