[英]DevExpress grids how to turn off sorting of columns
strong text I have grids showing to user and want to not allow sorting per column because I have added in totals where do I do this? 强文本我有网格显示给用户,并希望不允许每列排序,因为我已添加总计我在哪里这样做?
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:devx="http://schemas.devexpress.com/winfx/2008/xaml/grid">
//* * * * * * * *
•Your post does not have much context to explain the code sections; •您的帖子没有太多的上下文来解释代码部分; please explain your scenario more clearly. 请更清楚地解释您的情景。
<Grid x:Name="LayoutRoot" >
<Border BorderThickness="2" BorderBrush="AliceBlue" Margin="10" >
<StackPanel >
<Grid Background="AliceBlue" Height="30" >
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Margin="5" Text="Upload File">
</TextBlock>
</Grid>
<Grid>
//* * * * * * * *
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition Height="800"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5">
<Button Content="Upload File" Margin="0" Width="70" Height="35" Command="{Binding CmdUploadFile}" IsEnabled="{Binding IsEnableUploadFile, Mode=TwoWay}" ></Button>
<Button Content="Export" Margin="2,0,0,0" Width="70" x:Name="btnExport" Click="btnExport_Click"></Button>
</StackPanel>
//* * * * * * * *
<devx:GridControl
Grid.Row="1" x:Name="dgTest"
ShowLoadingPanel="{Binding Path=IsLoading, Mode=TwoWay}"
ItemsSource="{Binding Path=LstData, Mode=TwoWay}"
AutoPopulateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AllowColumnMRUFilterList="False"
IsFilterEnabled="False">
//* * * * * * * *
<devx:GridControl.Columns>
<devx:GridColumn Header="Fac ID" FieldName= "FacID" ReadOnly="True" Width="100" ></devx:GridColumn>
<devx:GridColumn Header="Patient ID" FieldName= "PatID" ReadOnly="True" Width="100" ></devx:GridColumn>
<devx:GridColumn Header="Patient" FieldName= "Patient" ReadOnly="True" Width="200" ></devx:GridColumn>
<devx:GridColumn Header="Price Cd" FieldName= "PriceCd" ReadOnly="True" Width="100" ></devx:GridColumn>
<devx:GridColumn Header="Invoice Group" FieldName= "InvoiceGrp" ReadOnly="True" Width="100" ></devx:GridColumn>
</devx:GridControl.Columns>
//* * * * * * * *
<devx:GridControl.View>
<devx:TableView></devx:TableView>
</devx:GridControl.View>
</devx:GridControl>
//* * * * * * * *
</Grid>
</StackPanel>
</Border>
</Grid>
//* * * * * * * *
</UserControl>
尝试这个
<devx:TableView AllowSorting="False"></devx:TableView>
You should go through the Sorting section of the WPF XtraGrid 您应该浏览WPF XtraGrid的Sorting部分
To remove sorting against a column the following can be done. 要删除对列的排序,可以执行以下操作。
Set the column's GridColumn.SortOrder property to ColumnSortOrder.None. 将列的GridColumn.SortOrder属性设置为ColumnSortOrder.None。
Remove the item that refers to the required column from the ColumnView.SortInfo collection. 从ColumnView.SortInfo集合中删除引用所需列的项。
Call the ColumnView.ClearSorting method. 调用ColumnView.ClearSorting方法。 This will remove the sort settings for all columns (except for grouping columns). 这将删除所有列的排序设置(分组列除外)。
gridView1.Columns["Country"].SortOrder = DevExpress.Data.ColumnSortOrder.None; gridView1.Columns [“Country”]。SortOrder = DevExpress.Data.ColumnSortOrder.None;
To prevent data sorting/grouping for specific columns use the OptionsColumn.AllowSort property. 要阻止特定列的数据排序/分组,请使用OptionsColumn.AllowSort属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.