In This Article

EnumListBox Class

Represents a list box that automatically presents the values of an enumeration.

public class EnumListBox : ListBox, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IGeneratorHost
Inheritance:
Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control ItemsControl Selector ListBox Object

Constructors

EnumListBox()

Initializes a new instance of the EnumListBox class.

public EnumListBox()

Properties

EnumSortComparer

Gets or sets the IComparer<T> used to sort the enumeration values.

public IComparer<Enum> EnumSortComparer { get; set; }

Property Value

IComparer<Enum>:

The IComparer<T> used to sort the enumeration values; otherwise null to indicate no sorting, which will use the order the enumeration values are defined.

EnumType

Gets or sets the enumeration type.

public Type EnumType { get; set; }

Property Value

Type:

The enumeration type.

EnumValue

Gets or sets the current enumeration value.

public object EnumValue { get; set; }

Property Value

Object:

The current enumeration value.

IsFlagsEnum

Gets a value indicating whether the EnumType has the FlagsAttribute.

public bool IsFlagsEnum { get; }

Property Value

Boolean:

true if the EnumType has the FlagsAttribute; otherwise false.

IsOnPopup

Gets or sets whether the control is being used on a popup, which affects how value changes are handled.

public bool IsOnPopup { get; set; }

Property Value

Boolean:

true if the control is being used on a popup; otherwise, false.

UseDisplayAttributes

Gets or sets a value indicating whether enumeration values should be displayed using an associated DisplayAttribute, if any.

public bool UseDisplayAttributes { get; set; }

Property Value

Boolean:

true if enumeration values should be displayed using an associated DisplayAttribute, if any; otherwise false. The default value is false.

Methods

GetContainerForItemOverride()

Creates or identifies the element used to display the specified item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

IsItemItsOwnContainerOverride(Object)

Determines if the specified item is (or is eligible to be) its own item container.

protected override bool IsItemItsOwnContainerOverride(object item)
Parameter Type Description
item Object

Specified item.

Returns

Boolean:

true if the item is its own item container; otherwise, false.

OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)

Occurs when a control within this control's hierarchy gains keyboard focus.

protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter Type Description
e KeyboardFocusChangedEventArgs

The KeyboardFocusChangedEventArgs that contains data related to this event.

OnKeyDown(KeyEventArgs)

Occurs when a key is pressed.

protected override void OnKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The KeyEventArgs that contains the event data.

PrepareContainerForItemOverride(DependencyObject, Object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The DependencyObject that is the wrapper element.

item Object

The item that is being wrapped.

Fields

EnumSortComparerProperty

Identifies the EnumSortComparer dependency property. This field is read-only.

public static readonly DependencyProperty EnumSortComparerProperty

EnumTypeProperty

Identifies the EnumType dependency property. This field is read-only.

public static readonly DependencyProperty EnumTypeProperty

EnumValueProperty

Identifies the EnumValue dependency property. This field is read-only.

public static readonly DependencyProperty EnumValueProperty

IsFlagsEnumProperty

Identifies the IsFlagsEnum dependency property. This field is read-only.

public static readonly DependencyProperty IsFlagsEnumProperty

IsOnPopupProperty

Identifies the IsOnPopup dependency property. This field is read-only.

public static readonly DependencyProperty IsOnPopupProperty

UseDisplayAttributesProperty

Identifies the UseDisplayAttributes dependency property. This field is read-only.

public static readonly DependencyProperty UseDisplayAttributesProperty

Inherited Members

Extension Methods