Gridview with an Enum Flags Column

0 Answers 3 Views
GridView
Stephan
Top achievements
Rank 3
Bronze
Iron
Iron
Stephan asked on 20 May 2025, 12:38 PM

Hello Telerik Support Team,

i found a solution for using enum values in a grid in the knowledge base:
https://docs.telerik.com/devtools/winforms/knowledge-base/gridview-comboboxcolumn-enum

I tried to adapt it for my purpose:

My enum and column definitions are:

[Flags]
public enum SpartenFlags
{
    [Display(Name = "Keine")]
    None = 0,
    Strom = 1,
    Gas = 2,
    Wasser = 4,
    Abwasser = 8,
    Breitband = 16,
    [Display(Name = "Fernwärme")]
    Fernwaerme = 32
}

gridViewComboBoxColumn2.EnableExpressionEditor = false;
gridViewComboBoxColumn2.FieldName = "Sparten";
gridViewComboBoxColumn2.HeaderText = "Sparten";
gridViewComboBoxColumn2.MinWidth = 25;
gridViewComboBoxColumn2.Name = "Sparten";
gridViewComboBoxColumn2.Width = 45;
gridViewComboBoxColumn2.DataSource = EnumWrapper<TBM_HAProzessPlugin.SpartenFlags>.EnumToList<TBM_HAProzessPlugin.SpartenFlags>();
gridViewComboBoxColumn2.DisplayMember = "Name";
gridViewComboBoxColumn2.ValueMember = "ID";

 

I override the view with a CustomGridImageCellElement (derived from GridDataCellElement) to display an icon depending on the combination of flag values. This works fine so far. But the filtering only works with single values. I would like to have a checkbox for each flag value and the filtering working correclty for every combination, that includes the checked values. Is there a way to archieve this?

 

Thank you for your help.

Best Regards,

Stephan

 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Stephan
Top achievements
Rank 3
Bronze
Iron
Iron
Share this question
or