代码之家  ›  专栏  ›  技术社区  ›  Aging Hippie

DatagridComboBoxColumn排序

  •  0
  • Aging Hippie  · 技术社区  · 6 年前

    XAML编号:

    <DataGridComboBoxColumn Header="Department" 
        ItemsSource="{Binding Source={StaticResource departmentViewSource}}" 
        DisplayMemberPath="Title" SelectedValuePath="ID" SortDirection="Ascending"
        SelectedValueBinding="{Binding DepartmentID, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
        SortMemberPath="lkpDepartments.Sequence" />
    

    谢谢。

    1 回复  |  直到 6 年前
        1
  •  0
  •   mm8    6 年前

    这个 SortMemberPath 适用于 DataGrid

    排序 ComboBox ,您应该排序 departmentViewSource SortDescription https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/how-to-sort-and-group-data-using-a-view-in-xaml .

    如果您使用相同的 CollectionViewSource 组合框