The following example demonstrates how to enable the column chooser and change the sort order of the column names it displays.
XAML |
Copy Code |
---|---|
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> <Grid.Resources> <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" Source="{Binding Source={x:Static Application.Current}, Path=Orders}" /> </Grid.Resources> <xcdg:DataGridControl x:Name="OrdersGrid" ItemsSource="{Binding Source={StaticResource cvs_orders}}"> <xcdg:DataGridControl.Columns> <xcdg:Column FieldName="OrderID" ShowInColumnChooser="False" /> <xcdg:Column FieldName="EmployeeID" Visible="False" /> <xcdg:Column FieldName="CustomerID" Visible="False" /> <xcdg:Column FieldName="ShipVia" Visible="False" /> </xcdg:DataGridControl.Columns> <xcdg:DataGridControl.View> <xcdg:TableView AllowColumnChooser="True" ColumnChooserSortOrder="TitleAscending" /> </xcdg:DataGridControl.View> </xcdg:DataGridControl> </Grid> |