Hi, We are using xamgrid and initially doing sorting on one column on loading of xamgrid. Now as duplication of items occurs in that column, we need to sort on basis of other secondary columns.
For sample take this code below:
<ig:XamGrid AutoGenerateColumns="False" ItemsSource="{Binding Items}" > <ig:XamGrid.SortingSettings> <ig:SortingSettings ></ig:SortingSettings> </ig:XamGrid.SortingSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="Side" MinimumWidth="20" Width="50"> <ig:TextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Side" ToolTip="Trade Side"></TextBlock> </DataTemplate> </ig:TextColumn.HeaderTemplate> </ig:TextColumn> <ig:TextColumn Key="CreatedOn" MinimumWidth="30" Width="68" FormatString="{}{0:HH:mm:ss}" AllowToolTips="Always" IsSorted="Descending"> <ig:TextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Created On" ToolTip="Date and time trade was created"/> </DataTemplate> </ig:TextColumn.HeaderTemplate> <ig:TextColumn.ToolTipContentTemplate> <DataTemplate> <TextBlock Text="{Binding CreatedOn, StringFormat={}{0:dd/MM/yyyy HH:mm:ss:fff}}" /> </DataTemplate> </ig:TextColumn.ToolTipContentTemplate> </ig:TextColumn> </ig:XamGrid.Columns> </ig:XamGrid>
Now here if in CreatedOn column if date is same for some rows, sorting should happen based on Side column.
How should I achieve that in xamgrid. I know there are some possibilities in xamDataGrid by using FieldlayoutSorting. But could you please tell in xamgrid case.Thanks.
Hello Mukesh,
You can enable the multi column sorting feature in the xamGrid by setting the AllowMultipleColumnSorting property to True.
<ig:XamGrid.SortingSettings>
<ig:SortingSettings AllowMultipleColumnSorting="True" />
</ig:XamGrid.SortingSettings>
I’ve attached a sample application for a reference.
Let me know if you have any questions with this matter.