Pergunta

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

Foi útil?

Solução

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
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top