我有以下DevExpress的GridControl:
<dxg:GridControl SelectionMode="Row">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="TimeStamp" Header="Local Computer Time"/>
<dxg:GridColumn FieldName="Level" Header="Level" >
<dxg:GridColumn.DisplayTemplate>
<ControlTemplate>
<StackPanel Orientation="Horizontal">
<!-- Convert severity to image -->
<TextBlock Text="{Binding Name}" />
</StackPanel>
</ControlTemplate>
</dxg:GridColumn.DisplayTemplate>
</dxg:GridColumn>
<dxg:GridColumn FieldName="RenderedMessage" Header="Message"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView ShowFixedTotalSummary="True" Name="view" ShowIndicator="False" ShowGroupPanel="False" ShowAutoFilterRow="False" AllowColumnFiltering="False" AllowEditing="False" AllowFilterEditor="False" AllowGrouping="False" AllowMasterDetail="False">
<dxg:TableView.ColumnMenuCustomizations>
<dxb:RemoveBarItemAndLinkAction ItemName="BestFitColumns" />
</dxg:TableView.ColumnMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
我想:
GridControl
按“TimeStamp”排序我该怎么做?我现在想弄清楚。
答案 0 :(得分:1)
事实上我刚刚找到了解决方案。
在GridControl
中,您必须设置SortInfo:
<dxg:GridControl Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" SelectionMode="Row" ItemsSource="{Binding EventsList}">
<dxg:GridControl.SortInfo>
<dxg:GridSortInfo FieldName="TimeStamp" SortOrder="Descending" />
</dxg:GridControl.SortInfo>
<!-- ... -->
</dxg:GridControl>