XtraGrid column checked list filter problem

雨燕双飞 提交于 2019-12-10 11:49:47

问题


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?

Thanks, Omky


回答1:


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
}


来源:https://stackoverflow.com/questions/5011853/xtragrid-column-checked-list-filter-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!