Collection of utilities, helper classes and WPF controls

Creating the Enum Bound ComboBox in WPF using xToolkit

This WPF control allows binding the fields of the flag enumeration to the multi-selection combo box.

Enumeration bound to combo box items
Enumeration bound to combo box items

Create flag enumeration with fields to be bound to the combo box

public enum EnumSample_e
    None = 0,
    Field1 = 1,
    Field2 = 2,
    Field3 = 4,
    Field2AndField3 = Field2 | Field3,
    Field4 = 8

Bind the View Model property in the XAML to the Value dependency property.

public class EnumComboBoxControlVM
    public EnumSample_e EnumPrp { get; set; }

<UserControl x:Class="Wpf.Docs.EnumComboBoxControl"
        <ctrls:EnumComboBox Value="{Binding Path=EnumPrp}"/>

Control supports joined values as well as none (0) value. These items will be assigned with blue and gray colors correspondingly.

Powered by Docify