Class CategoryToGlyphConverter
- Namespace
- Tudormobile.OpenTrivia.UI.Converters
- Assembly
- Tudormobile.OpenTrivia.UI.dll
Converts trivia category identifiers to Segoe MDL2 Assets glyph characters for visual representation.
public class CategoryToGlyphConverter : IValueConverter
- Inheritance
-
CategoryToGlyphConverter
- Implements
- Inherited Members
Remarks
This converter supports conversion from int, SelectableCategory, and TriviaCategory types to string glyphs representing category icons. Each category ID maps to a specific Unicode character from the Segoe MDL2 Assets font.
Constructors
CategoryToGlyphConverter()
public CategoryToGlyphConverter()
Methods
Convert(object?, Type, object?, CultureInfo)
Converts a trivia category value to its corresponding Segoe MDL2 Assets glyph character.
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
valueobjectThe category value to convert. Can be an int category ID, a SelectableCategory, or a TriviaCategory.
targetTypeTypeThe type of the binding target property. When string, returns the appropriate glyph character; otherwise returns a default glyph.
parameterobjectOptional converter parameter (not used).
cultureCultureInfoThe culture to use in the converter (not used).
Returns
- object
A string containing a Unicode glyph character representing the category, or a question mark glyph (❓) if the category is not recognized.
ConvertBack(object?, Type, object?, CultureInfo)
Converts a glyph character back to a category value.
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
valueobjectThe glyph character to convert back.
targetTypeTypeThe type to convert to.
parameterobjectOptional converter parameter (not used).
cultureCultureInfoThe culture to use in the converter (not used).
Returns
- object
Not supported - this method always throws NotImplementedException.
Exceptions
- NotImplementedException
This converter does not support two-way binding.