EnumBarGalleryItemViewModel<TEnum> Class
Represents a view model for a gallery item whose value and label based on the value in an enumeration.
public class EnumBarGalleryItemViewModel<TEnum> : BarGalleryItemViewModel<TEnum>, IBarGalleryItemViewModel, IEquatable<IBarGalleryItemViewModel> where TEnum : struct, IComparable, IFormattable
- Type Parameters:
-
TEnum
-The enumeration type of the value associated with this gallery item.
- Inheritance:
- object ObservableObjectBase BarGalleryItemViewModel<TEnum> object
- Implements:
- IBarGalleryItemViewModel IEquatable<IBarGalleryItemViewModel>
Constructors
EnumBarGalleryItemViewModel()
Initializes a new instance of the class.
public EnumBarGalleryItemViewModel()
EnumBarGalleryItemViewModel(TEnum)
Initializes a new instance of the class with the specified value.
public EnumBarGalleryItemViewModel(TEnum value)
Parameter | Type | Description |
---|---|---|
value | TEnum | The item's value. |
EnumBarGalleryItemViewModel(TEnum, string)
Initializes a new instance of the class with the specified value and category.
public EnumBarGalleryItemViewModel(TEnum value, string category)
Parameter | Type | Description |
---|---|---|
value | TEnum | The item's value. |
category | string | The item's category, or |
EnumBarGalleryItemViewModel(TEnum, string, string)
Initializes a new instance of the class with the specified value, category, and label.
public EnumBarGalleryItemViewModel(TEnum value, string category, string label)
Parameter | Type | Description |
---|---|---|
value | TEnum | The item's value. |
category | string | The item's category, or |
label | string | The text label to display, or |
Properties
IsLabelVisible
Gets whether the Label is visible.
public override bool IsLabelVisible { get; }
Property Value
Order
Gets or sets the sort order for this item, where lower values appear before higher values.
Methods
CreateCollection()
Creates a collection of gallery item view models representing the values defined for an enumeration type.
public static IEnumerable<EnumBarGalleryItemViewModel<TEnum>> CreateCollection()
Returns
- IEnumerable<EnumBarGalleryItemViewModel<TEnum>>:
The collection of gallery item view models that was created.
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
RefreshFromAttributes()
Refreshes supported properties based the attributes, if any, defined on the enumeration field associated with this view model's value. Properties are only updated if a non-null value is obtained from the corresponding attribute. Otherwise, existing property values are unchanged.
public void RefreshFromAttributes()
Remarks
Call this method after any changes in locale since DisplayAttribute supports localization and is used to populate several properties on this view model.
Fields
DefaultOrder
Gets the default sort order for enumeration items that do not define an order using the Order property.
public const int DefaultOrder = 10000
Inherited Members
- BarGalleryItemViewModel<TEnum>.CoerceLabel()
- BarGalleryItemViewModel<TEnum>.ConvertEnumValueToString<TEnum>(TEnum, bool)
- BarGalleryItemViewModel<TEnum>.ConvertEnumValueToString(Type, object, bool)
- BarGalleryItemViewModel<TEnum>.Equals(object)
- BarGalleryItemViewModel<TEnum>.Equals(IBarGalleryItemViewModel)
- BarGalleryItemViewModel<TEnum>.GetHashCode()
- BarGalleryItemViewModel<TEnum>.OnValueChanged()
- BarGalleryItemViewModel<TEnum>.ToString()
- BarGalleryItemViewModel<TEnum>.Category
- BarGalleryItemViewModel<TEnum>.Description
- BarGalleryItemViewModel<TEnum>.ImageSource
- BarGalleryItemViewModel<TEnum>.IsVisible
- BarGalleryItemViewModel<TEnum>.KeyTipText
- BarGalleryItemViewModel<TEnum>.Label
- BarGalleryItemViewModel<TEnum>.LayoutBehavior
- BarGalleryItemViewModel<TEnum>.Value
- ObservableObjectBase.NotifyPropertyChanged(string)
- ObservableObjectBase.OnPropertyChanged(PropertyChangedEventArgs)
- ObservableObjectBase.SetProperty<T>(ref T, T, string)
- ObservableObjectBase.PropertyChanged
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)