XtraGrid中列的检查列表过滤器问题过滤器、问题、列表、XtraGrid

2023-09-04 06:24:42 作者:╰格式化丶孤单︶ ̄

我在我的应用程序中使用XtraGrid中。我已经展示了检查列表框与列筛选唯一值。现在,我想列举这些项目进行了检查,一旦点击确定按钮后,对话框消失。如何做到这一点?

I am using XtraGrid in my application. I have shown checked list box with unique values for the column filter. Now, I want to enumerate which Items were checked once the dialog disappears after clicking OK button. How to do this?

谢谢, Omky

推荐答案

虽然我不知道你的检查列表框的过滤器弹出的准确实施,您可以处理 Col​​umnFilterChanged 事件的GridView控件。那么,我建议你分析你列的FilterCriteria,看看哪些价值被用于过滤。

While I don't know the exact implementation of your checked listbox in the filter popup, you can handle the ColumnFilterChanged event on the GridView. Then, I suggest that you analyse the FilterCriteria of your column and see which value are being used for filtering.

private void gridView1_ColumnFilterChanged(object sender, EventArgs e)
{
    var filteredValues = new List<string>();

    var criteria = gridColumn1.FilterInfo.FilterCriteria;

    if (criteria is GroupOperator)
    {
        var group = (GroupOperator)criteria;
        foreach (var operand in group.Operands.OfType<BinaryOperator>())
        {
            var value = (OperandValue)operand.RightOperand;
            filteredValues.Add(value.Value.ToString());
        }
    }
    else if(criteria is BinaryOperator)
    {
        var value = (OperandValue)((BinaryOperator)criteria).RightOperand;
        filteredValues.Add(value.Value.ToString());

    }

    // Do something with the filtered values
}