2012-03-06 123 views
1

我有一個Datagrid.Sorting不適合它。排序不適用於我的WPF DataGrid?

我不知道問題出在哪裏,我查了一下。

我沒有找到解決方案。

我的代碼是

<toolkit:DataGrid Name="TSGrid" RowHeaderWidth="0" IsSynchronizedWithCurrentItem="True" 
            SelectionChanged="TSGrid_SelectionChanged" GridLinesVisibility="Horizontal" 
            RowHeight="25" 
            ColumnHeaderStyle="{DynamicResource ColumnHeaderStyle}" FontSize="12" 
            BorderBrush="DarkGreen" BorderThickness="1" ColumnHeaderHeight="30" 
            IsReadOnly="True" ItemsSource="{Binding}" 
            CanUserAddRows="False" CanUserReorderColumns="True" SelectionMode="Single" 
            SelectionUnit="FullRow" CanUserResizeColumns="True" 
            AreRowDetailsFrozen="False" RowStyle="{StaticResource RowStyle}" 
            AutoGenerateColumns="False" LoadingRow="TSGrid_LoadingRow" Margin="4,0,0,4"> 

任何人都可以在這方面的幫助?

在此先感謝

拉姆金

回答

0

您需要的DataGrid的CanUserSortColumns屬性設置爲True

+0

默認情況下,CanUserSortColumns = True.I嘗試過。但是當我點擊Headers時它不起作用 – user768853 2012-03-06 08:59:33

+4

您是否設置了列的SortMemberPath屬性? – gaurawerma 2012-03-06 09:06:08

+0

Hi Gaurawerma ....不,我沒有設置SortMemberPath屬性 – user768853 2012-03-06 09:15:04