Class SelectableCategory
- Namespace
- Tudormobile.OpenTrivia.UI.ViewModels
- Assembly
- Tudormobile.OpenTrivia.UI.dll
Represents a selectable trivia category that encapsulates a trivia category and tracks its selection state for use in user interfaces.
public class SelectableCategory : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging
- Inheritance
-
SelectableCategory
- Implements
- Inherited Members
Remarks
This class is designed to facilitate data binding scenarios where a trivia category needs to be presented with a selectable state, such as in list or toggle button controls. The selection state is managed by the IsSelected property, which can be bound to UI elements to reflect user interaction.
Constructors
SelectableCategory(TriviaCategory)
Creates a new instance of the SelectableCategory class, initializing it with the provided trivia category.
public SelectableCategory(TriviaCategory category)
Parameters
categoryTriviaCategoryThe trivia category to encapsulate.
Properties
Id
Gets the unique identifier for the category.
public int Id { get; }
Property Value
IsSelected
[ObservableProperty]
[ExcludeFromCodeCoverage]
public bool IsSelected { get; set; }
Property Value
Name
Gets the name of the category.
public string Name { get; }
Property Value
Operators
implicit operator TriviaCategory(SelectableCategory)
Implicitly converts a SelectableCategory to its underlying TriviaCategory.
public static implicit operator TriviaCategory(SelectableCategory selectableCategory)
Parameters
selectableCategorySelectableCategoryThe selectable category to convert.