Skip to main content

FilterControl.MaxOperandsCount Property

Gets or sets the maximum number of atomic operands simultaneously displayed within a group operand. If there are more atomic operands in display mode, the group operand’s text representation will be trimmed. In edit mode, the group operand’s values will be edited via a CheckedComboBoxEdit control. This feature is supported when the FilterControl is bound to XtraGrid.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(20)]
[DXCategory("Behavior")]
public int MaxOperandsCount { get; set; }

Property Value

Type Default Description
Int32 20

An integer value that specifies the maximum number of atomic operands simultaneously displayed within a group operand.

Remarks

Group operands are used to define values for the Is any of and Is none of operators:

FilterControl_GroupOperand

If the number of atomic operands in a group operand is equal to or less than MaxOperandsCount, the FilterControl displays all the atomic operands, separating them with a comma. Each operand can be edited within a separate edit box:

FilterControl_MaxOperandsCount_Less

If the number of atomic operands is greater than MaxOperandsCount, the following takes place if the FilterControl is bound to Grid Control via the FilterControl.SourceControl property:

  • in display mode, the group operand’s text representation is trimmed.

    FilterControl_MaxOperandsCount_Greater_DisplayMode

  • in edit mode, the group operand is edited via a CheckedComboBoxEdit control.

    FilterControl_MaxOperandsCount_Greater_EditMode

If the FilterControl is not bound to XtraGrid, the CheckedComboBoxEdit control can still be used to present a group operand’s value. The following example shows how to accomplish this.

Example - How to use CheckedComboBox control when editing IsAnyOf and IsNoneOf operands in FilterControl bound to any object except XtraGrid

In FilterControl, there are two operand presentation modes when editing the "Is Any Of" and "Is None Of" group operands: simple and advanced. The simple mode is enabled when the number of atomic operands in a group operand is equal to or less than FilterControl.MaxOperandCount. Otherwise the advanced mode is activated, where:- in display mode, a group operand's text presentation is trimmed.- in edit mode, the group operand's values are edited with the help of the CheckedComboBoxEdit control. The advanced operand presentation mode is supported when the FilterControl is bound to the XtraGrid. Otherwise, this feature is not supported. This example shows how to overcome this limitation by creating a custom SourceControl component and an UnbounFilterColumn descendant.In the descendant class two members are overridden:- The AllowItemCollectionEditor property determines whether or not the feature is allowed for certain columns.- The CreateItemCollectionEditor method creates a CheckedComboBoxEdit control.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace B217847Example
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Example

In FilterControl, there are two operand presentation modes when editing the "Is Any Of" and "Is None Of" group operands: simple and advanced. The simple mode is enabled when the number of atomic operands in a group operand is equal to or less than FilterControl.MaxOperandCount. Otherwise the advanced mode is activated, where:- in display mode, a group operand's text presentation is trimmed.- in edit mode, the group operand's values are edited with the help of the CheckedComboBoxEdit control. The advanced operand presentation mode is supported when the FilterControl is bound to the XtraGrid. Otherwise, this feature is not supported. This example shows how to overcome this limitation by creating a custom SourceControl component and an UnbounFilterColumn descendant.In the descendant class two members are overridden:- The AllowItemCollectionEditor property determines whether or not the feature is allowed for certain columns.- The CreateItemCollectionEditor method creates a CheckedComboBoxEdit control.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace B217847Example
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}
See Also