Tags
Overview
Tag is a compact templated control that displays a short piece of metadata: an optional icon, an optional bold key, and an optional value. TagViewModel is a small view model for building dynamic tag collections that are rendered with Tag controls through an items control.
The component provides:
a key–value layout with an optional Material icon;
status classes:
error,warning,success,unknown;an info palette of 20 categorical colors:
info1–info20;animation classes:
blink,blinkonce,fadein,fadeout,fadeinblink;the
AsvPallete.Colorattached property that mapsAsvColorKindflags to the classes above.
Each part of the tag is optional. The icon is hidden when Icon is null, the key and the : separator are hidden when Key is null, and the value text is hidden when Value is null. The control height is derived from FontSize, so tags scale together with their text.
Usage
Add the control directly to XAML:
For dynamic collections, fill an ObservableList<TagViewModel> and expose a synchronized view:
Render the collection with an items control and bind the view model color through AsvPallete.Color:
Styling
Without any classes the tag uses the info3 colors of the theme palette. Every color class sets a matching foreground and background brush pair from the theme, and the border always follows the foreground:
error,warning,success,unknownmark a status;info1–info20pick one of 20 categorical colors for grouping and labeling.
Animation classes change how the tag appears:
Class | Behavior |
|---|---|
| Blinks indefinitely. |
| Blinks three times quickly and stops. |
| Fades in from transparent to fully visible. |
| Fades out from visible to transparent. |
| Fades in, then blinks three times softly. |
API
Tag
A templated control that displays an icon, a key, and a value. Standard TemplatedControl properties such as FontSize, Foreground, Background, BorderThickness, and CornerRadius apply.
Property | Type | Description |
|---|---|---|
|
| Gets or sets the icon. The default value is |
|
| Gets or sets the key text shown in bold before the |
|
| Gets or sets the value text. |
TagViewModel
Provides the data for a single tag in a dynamic collection.
TagViewModel constructors
Constructor | Description |
|---|---|
| Initializes a new instance of the |
Property | Type | Description |
|---|---|---|
|
| Gets or sets the color and animation flags applied to the tag. |
|
| Gets or sets the key text. |
|
| Gets or sets the value text. |
|
| Gets or sets the icon. |