开发者

XtraGrid column checked list filter problem

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 dis开发者_JAVA技巧appears after clicking OK button. How to do this?

Thanks, Omky


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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜