In This Article

EnumEditBox Class

Represents an Enum edit box.

public class EnumEditBox : PartEditBoxBase<object>
Inheritance:
object Visual UIElement FrameworkElement Control PartEditBoxBase<object> object

Constructors

EnumEditBox()

Initializes an instance of the class.

public EnumEditBox()

Properties

EnumSortComparer

The IComparer<T> used to sort the enumeration values, or null to use default sorting.

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

Property Value

IComparer<Enum>:

By default, enumeration values are sorted by the order in which the values are defined. When UseDisplayAttributes is true, the DisplayAttribute.Order, if any, will be preferred over the definition order.

EnumType

The enumeration type.

public Type? EnumType { get; set; }

Property Value

Type

HasPopupButtonWhenReadOnly

Indicates whether the control should display the popup button when the control is read-only.

protected override bool HasPopupButtonWhenReadOnly { get; }

Property Value

bool:

true if the control should display the popup button when the control is read-only; otherwise, false.

NullValueText

The text to display for a null value item when IsNullAllowed is true.

public string NullValueText { get; set; }

Property Value

string

UseDisplayAttributes

Indicates whether enumeration values should be displayed using an associated DisplayAttribute, if any.

public bool UseDisplayAttributes { get; set; }

Property Value

bool:

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

Methods

ConvertToString(object?)

Converts the specified value to a string representation.

protected override string ConvertToString(object? valueToConvert)
Parameter Type Description
valueToConvert object

The value.

Returns

string:

The string representation of the specified value.

CreateIncrementalChangeRequest(IncrementalChangeRequestKind)

Creates an incremental change (spin) request.

protected override IncrementalChangeRequest<object> CreateIncrementalChangeRequest(IncrementalChangeRequestKind kind)
Parameter Type Description
kind IncrementalChangeRequestKind

The kind of request.

Returns

IncrementalChangeRequest<object>:

The incremental change (spin) request that was created.

GenerateParts()

Generates the parts for the edit box.

protected override IList<IPart> GenerateParts()

Returns

IList<IPart>:

The parts that were generated.

IsValidValue(object?)

Tests whether the specified value is valid.

protected override bool IsValidValue(object? value)
Parameter Type Description
value object

The value to examine.

Returns

bool:

true if the value is valid; otherwise, false.

OnPropertyChanged(DependencyPropertyChangedEventArgs)

Invoked whenever the effective value of any dependency property on this FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs).

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data that describes the property that changed, as well as old and new values.

ResetValue()

Resets the value to a default value.

protected override void ResetValue()

TryConvertFromString(string?, bool, out object?)

Tries to convert the specified text to a value.

protected override bool TryConvertFromString(string? textToConvert, bool canCoerce, out object? value)
Parameter Type Description
textToConvert string

The text.

canCoerce bool

Whether the returned value should be coerced to fall within the allowed value range.

value object

Returns the value for the specified text.

Returns

bool:

true if the text was converted to a value successfully; otherwise, false.

Fields

EnumSortComparerProperty

Defines the EnumSortComparer property.

public static readonly DependencyProperty EnumSortComparerProperty

EnumTypeProperty

Defines the EnumType property.

public static readonly DependencyProperty EnumTypeProperty

NullValueTextProperty

Defines the NullValueText property.

public static readonly DependencyProperty NullValueTextProperty

UseDisplayAttributesProperty

Defines the UseDisplayAttributes property.

public static readonly DependencyProperty UseDisplayAttributesProperty

Inherited Members

Extension Methods