WPF Telerik RadGridView过滤器未应用于复选框

时间:2017-05-26 13:59:31

标签: c# wpf checkbox filter telerik

我有一个包含RadGridView的页面和一些用于快速过滤RadGridView数据的按钮。

当用户点击其中一个按钮时,会在视图中添加FilterDescriptor并应用过滤器。如果用户点击"仅显示新项目",则会应用过滤器并显示新项目。

这适用于除布尔复选框列以外的所有列。应用过滤器时,找不到匹配的项目。我尝试过很多东西,但似乎没什么用。

XAML

<telerik:GridViewCheckBoxColumn UniqueName="CorrectiveActionRequired" Header="Corrective Action" IsReadOnly="False" IsEnabled="True" IsFilterable="True"
                                            DataMemberBinding="{Binding CorrectiveActionTaken, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                            AutoSelectOnEdit="True" EditTriggers="CellClick" />

C#

private void FilterByCorrectiveActionRequired(object sender, MouseButtonEventArgs e)
{
    this.NearMissRadGridView.FilterDescriptors.Clear();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.Member = "CorrectiveActionRequired";
    descriptor.Operator = FilterOperator.IsEqualTo;
    descriptor.Value = true;
    this.NearMissRadGridView.FilterDescriptors.Add(descriptor);
}

1 个答案:

答案 0 :(得分:1)

尝试将Member属性设置为&#34; CorrectiveActionTaken&#34;这是属性的实际名称(我想):

private void FilterByCorrectiveActionRequired(object sender, MouseButtonEventArgs e)
{
    this.NearMissRadGridView.FilterDescriptors.Clear();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.Member = "CorrectiveActionTaken"; //<--
    descriptor.Operator = FilterOperator.IsEqualTo;
    descriptor.Value = true;
    this.NearMissRadGridView.FilterDescriptors.Add(descriptor);
}