Skip to main content

FilterChipGroupItem Class

A filter item that allows you to select a single option from a set of chips.

Namespace: DevExpress.Maui.Editors

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

Declaration

public class FilterChipGroupItem :
    FilterChipGroupItemBase

Remarks

The image below shows a sample filter chip group:

DevExpress Filtering UI for MAUI - Chip group

To use a FilterChipGroupItem in your filtering UI, bind its Context property to the data control’s FilteringContext (DataGridView.FilteringContext or DXCollectionView.FilteringContext). Then specify the FilterChipGroupItem’s FieldName property to set by which data source property values the data control should filter its items:

<ContentPage ...
             xmlns:dxe="clr-namespace:DevExpress.Maui.Editors;assembly=DevExpress.Maui.Editors">
             <!--...-->
                <dxe:FilterChipGroupItem Context="{Binding}" Text="Property Status" FieldName="Status" CustomDisplayText="OnCustomDisplayText"/>
             <!--...-->
</ContentPage>
FilterPage FilterPage => filterPage ??= new FilterPage() { BindingContext = dataControl.FilteringContext };

EnumToDescriptionConverter EnumToDescriptionConverter { get; } = new EnumToDescriptionConverter();

void OnCustomDisplayText(object sender, FilterElementCustomDisplayTextEventArgs e) {
    e.DisplayText = EnumToDescriptionConverter.Convert(e.Value).ToString();
}

public class EnumToDescriptionConverter : IMarkupExtension, IValueConverter {
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
        return Convert(value);
    }

    public object Convert(object value) {
        var enumValue = (Enum)value;
        var member = enumValue.GetType().GetMember(enumValue.ToString());
        var attributes = member[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
        return (attributes.Length > 0) ? ((DescriptionAttribute)attributes[0]).Description : null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
        throw new NotSupportedException();
    }

    public object ProvideValue(IServiceProvider serviceProvider) {
        return this;
    }
}

You can also replace the default editor with a custom editor. To do so, specify the FilterChipGroupItem’s FilterModelTemplate property. Use the FilterChipGroupItem’s FilterModel property to obtain the binding context for the template.

For more information on how to implement a Filtering UI for DataGridView and DXCollectionView, refer to the following sections:

Inheritance

Show 12 items
See Also