BarGalleryItemViewModel<TValue> Class
Represents a view model for a gallery item within a bar gallery control.
public class BarGalleryItemViewModel<TValue> : ObservableObjectBase, IBarGalleryItemViewModel, IEquatable<IBarGalleryItemViewModel>, IHasTag
- Type Parameters:
-
TValue
-The type of the value associated with this gallery item.
- Inheritance:
- object ObservableObjectBase object
- Derived:
- ColorBarGalleryItemViewModel EnumBarGalleryItemViewModel<TEnum> FontFamilyBarGalleryItemViewModel FontSizeBarGalleryItemViewModel SymbolBarGalleryItemViewModel TextBarGalleryItemViewModel TextStyleBarGalleryItemViewModel
Constructors
BarGalleryItemViewModel()
Initializes a new instance of the class.
protected BarGalleryItemViewModel()
BarGalleryItemViewModel(TValue?)
Initializes a new instance of the class with the specified value.
protected BarGalleryItemViewModel(TValue? value)
Parameter | Type | Description |
---|---|---|
value | TValue | The item's value. |
BarGalleryItemViewModel(TValue?, string?)
Initializes a new instance of the class with the specified value and category.
protected BarGalleryItemViewModel(TValue? value, string? category)
Parameter | Type | Description |
---|---|---|
value | TValue | The item's value. |
category | string | The item's category, or |
BarGalleryItemViewModel(TValue?, string?, string?)
Initializes a new instance of the class with the specified value, category, and label.
protected BarGalleryItemViewModel(TValue? value, string? category, string? label)
Parameter | Type | Description |
---|---|---|
value | TValue | The item's value. |
category | string | The item's category, or |
label | string | The text label to display, or |
Properties
Category
The item's category.
Description
The text description to display in screen tips.
Icon
The value representing the icon to display, if the item's template supports an icon.
IsLabelVisible
Indicates whether the Label is visible.
IsVisible
Indicates whether the control is currently visible.
KeyTipText
The key tip text used to access the control.
Label
The text label to display.
public string? Label { get; set; }
Property Value
Remarks
If the label is not explicitly defined, the value may be coerced.
LayoutBehavior
A BarGalleryItemLayoutBehavior indicating how the gallery item should be visually displayed.
public BarGalleryItemLayoutBehavior LayoutBehavior { get; set; }
Property Value
- BarGalleryItemLayoutBehavior:
The default value is Default.
Tag
A user-defined object attached to the control.
Value
The value associated with this view model.
public virtual TValue? Value { get; set; }
Property Value
- TValue
Methods
CoerceLabel()
Gets the coerced value to use as the Label when an explicit value has not been defined.
ConvertEnumValueToString(Type, object?, bool)
Converts the specified enumeration value to a string representation.
protected static string? ConvertEnumValueToString(Type enumType, object? enumValue, bool useAttributes)
Parameter | Type | Description |
---|---|---|
enumType | Type | The enumeration Type to examine. |
enumValue | object | The enumeration value. |
useAttributes | bool | Whether to use description or display attributes. |
Returns
- string:
A string representation of the specified value or
null
if the value and/or type is not recognized as an enumeration.
ConvertEnumValueToString<TEnum>(TEnum, bool)
Converts the specified enumeration value to a string representation.
protected static string? ConvertEnumValueToString<TEnum>(TEnum enumValue, bool useAttributes) where TEnum : Enum
- Type Parameters:
-
TEnum
-The type of the enumeration.
Parameter | Type | Description |
---|---|---|
enumValue | TEnum | The enumeration value. |
useAttributes | bool | Whether to use description or display attributes. |
Returns
- string:
A string representation of the specified value or
null
if the value type is not an enumeration.
Equals(IBarGalleryItemViewModel?)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(IBarGalleryItemViewModel? other)
Parameter | Type | Description |
---|---|---|
other | IBarGalleryItemViewModel | An object to compare with this object. |
Returns
- bool:
true
if the current object is equal to theother
parameter; otherwise,false
.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override sealed bool Equals(object? obj)
Parameter | Type | Description |
---|---|---|
obj | object | The object to compare with the current object. |
Returns
- bool:
true
if the specified object is equal to the current object; otherwise,false
.
GetHashCode()
Serves as the default hash function.
OnValueChanged()
Raises the PropertyChanged event for the Value property and any other properties that are dependent on the value.
protected virtual void OnValueChanged()
ToString()
Returns the string representation of this object.
Inherited Members
- ObservableObjectBase.OnPropertyChanged(string)
- ObservableObjectBase.OnPropertyChanged(PropertyChangedEventArgs)
- ObservableObjectBase.OnPropertyChanging(string)
- ObservableObjectBase.OnPropertyChanging(PropertyChangingEventArgs)
- ObservableObjectBase.SetProperty<T>(ref T, T, string)
- ObservableObjectBase.PropertyChanged
- ObservableObjectBase.PropertyChanging
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)