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 EnumEditBox class.
public EnumEditBox()
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
nullto use default sorting. By default, enumeration values are sorted by the order in which the values are defined. When UseDisplayAttributes istrue, theDisplayAttribute.Order, if any, will be preferred over the definition order.
EnumType
Gets or sets the enumeration type.
HasPopupButtonWhenReadOnly
Gets whether the control should display the popup button when the control is read-only.
protected override bool HasPopupButtonWhenReadOnly { get; }
Property Value
- bool:
trueif the control should display the popup button when the control is read-only; otherwise,false.
NullValueText
Gets or sets the text to display for a null value item when IsNullAllowed is true.
public string NullValueText { get; set; }
Property Value
- string:
The text to display for a null value item.
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
- bool:
trueif enumeration values should be displayed using an associatedDisplayAttribute, if any; otherwisefalse. The default value isfalse.
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
IsValidValue(object)
Returns whether the specified value is valid.
protected override bool IsValidValue(object value)
| Parameter | Type | Description |
|---|---|---|
| value | object | The value to examine. |
Returns
- bool:
trueif 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. |
RaiseValueChangedEvent()
Raises the ValueChanged event.
protected override void RaiseValueChangedEvent()
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:
trueif the text was converted to a value successfully; otherwise,false.
Events
ValueChanged
Occurs after the Value property value changes.
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
NullValueTextProperty
Identifies the NullValueText dependency property. This field is read-only.
public static readonly DependencyProperty NullValueTextProperty
UseDisplayAttributesProperty
Identifies the UseDisplayAttributes dependency property. This field is read-only.
public static readonly DependencyProperty UseDisplayAttributesProperty
Inherited Members
- PartEditBoxBase<object>.ActivePartIndexProperty
- PartEditBoxBase<object>.CommitTriggersProperty
- PartEditBoxBase<object>.HasPopupProperty
- PartEditBoxBase<object>.InlinesProperty
- PartEditBoxBase<object>.InputScopeNameValueProperty
- PartEditBoxBase<object>.IntermediateValueProperty
- PartEditBoxBase<object>.IsArrowKeyPartNavigationEnabledProperty
- PartEditBoxBase<object>.IsEditableProperty
- PartEditBoxBase<object>.IsNullAllowedProperty
- PartEditBoxBase<object>.IsPopupButtonVisibleProperty
- PartEditBoxBase<object>.IsPopupOpenProperty
- PartEditBoxBase<object>.IsReadOnlyProperty
- PartEditBoxBase<object>.IsSpinnerVisibleProperty
- PartEditBoxBase<object>.IsUndoEnabledProperty
- PartEditBoxBase<object>.PlaceholderTextProperty
- PartEditBoxBase<object>.PopupBackgroundProperty
- PartEditBoxBase<object>.PopupBorderBrushProperty
- PartEditBoxBase<object>.PopupPickerStyleProperty
- PartEditBoxBase<object>.SpinWrappingProperty
- PartEditBoxBase<object>.TextAlignmentProperty
- PartEditBoxBase<object>.ValueProperty
- PartEditBoxBase<object>.IsNonDefaultUsageContextProperty
- PartEditBoxBase<object>.SpinnerVisibilityProperty
- PartEditBoxBase<object>.UsageContextProperty
- PartEditBoxBase<object>.CoerceValidValue(object)
- PartEditBoxBase<object>.Commit()
- PartEditBoxBase<object>.Commit(bool)
- PartEditBoxBase<object>.InvalidateParts()
- PartEditBoxBase<object>.OnApplyTemplate()
- PartEditBoxBase<object>.OnCreateAutomationPeer()
- PartEditBoxBase<object>.OnGotFocus(RoutedEventArgs)
- PartEditBoxBase<object>.OnIntermediateValueChanged(object, object)
- PartEditBoxBase<object>.OnIsNullAllowedChanged(bool, bool)
- PartEditBoxBase<object>.OnKeyDown(KeyEventArgs)
- PartEditBoxBase<object>.OnLostFocus(RoutedEventArgs)
- PartEditBoxBase<object>.OnPopupOpened()
- PartEditBoxBase<object>.OnValueChanged(object, object)
- PartEditBoxBase<object>.ProcessTextInput(string)
- PartEditBoxBase<object>.SelectAll()
- PartEditBoxBase<object>.UpdateIntermediateValueAndTextFromValue()
- PartEditBoxBase<object>.OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
- PartEditBoxBase<object>.OnLostMouseCapture(MouseEventArgs)
- PartEditBoxBase<object>.OnMouseLeftButtonDown(MouseButtonEventArgs)
- PartEditBoxBase<object>.OnPreviewMouseUp(MouseButtonEventArgs)
- PartEditBoxBase<object>.OnPreviewTextInput(TextCompositionEventArgs)
- PartEditBoxBase<object>.ActivePartIndex
- PartEditBoxBase<object>.CommitTriggers
- PartEditBoxBase<object>.CurrentSelectionLength
- PartEditBoxBase<object>.CurrentSelectionStartOffset
- PartEditBoxBase<object>.CurrentText
- PartEditBoxBase<object>.HasPopup
- PartEditBoxBase<object>.Inlines
- PartEditBoxBase<object>.InputScopeNameValue
- PartEditBoxBase<object>.IntermediateValue
- PartEditBoxBase<object>.IsArrowKeyPartNavigationEnabled
- PartEditBoxBase<object>.IsEditable
- PartEditBoxBase<object>.IsNullAllowed
- PartEditBoxBase<object>.IsPopupButtonVisible
- PartEditBoxBase<object>.IsPopupOpen
- PartEditBoxBase<object>.IsReadOnly
- PartEditBoxBase<object>.IsSpinnerVisible
- PartEditBoxBase<object>.IsUndoEnabled
- PartEditBoxBase<object>.Parts
- PartEditBoxBase<object>.PlaceholderText
- PartEditBoxBase<object>.PopupBackground
- PartEditBoxBase<object>.PopupBorderBrush
- PartEditBoxBase<object>.PopupPickerStyle
- PartEditBoxBase<object>.ResetValueCommand
- PartEditBoxBase<object>.SmallDecrementValueCommand
- PartEditBoxBase<object>.SmallIncrementValueCommand
- PartEditBoxBase<object>.SpinWrapping
- PartEditBoxBase<object>.TextAlignment
- PartEditBoxBase<object>.Value
- PartEditBoxBase<object>.IsNonDefaultUsageContext
- PartEditBoxBase<object>.SpinnerVisibility
- PartEditBoxBase<object>.UsageContext