title | author | description | keywords | dev_langs | |
---|---|---|---|---|---|
MetadataControl |
vgromfeld |
The MetadataControl control displays a list of labels and hyper-links separated by a bullet. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, metadata, metadatacontrol |
|
The MetadataControl control displays a list of labels and hyper-links separated by a bullet. It also generates an accessible string representing its content.
The bullet separator can be customized using the Separator
property.
AccessibleSeparator
is used as a replacement for Separator
to generate the accessible string.
The control needs a list of MediadataItem.
Each item will be displayed either as a text or as an hyper-link (if the Command
property is set).
The default control template is using on a TextBlock
. The style of this TextBlock
can be customized using the TextBlockStyle
property.
[!div class="nextstepaction"] Try it in the sample app
Add the control in the page:
<controls:MetadataControl
x:Name="metadataControl"
Separator=" • "
AccessibleSeparator=", "/>
Add items to control:
metadataControl.Items = new[]
{
new MetadataItem { Label = "Hello" },
new MetadataItem { Label = "World", Command = myCommand },
};
A MediadataItem
contains the information about one entry which will be displayed in the MetadataControl
Property | Type | Description |
---|---|---|
Label | String | Gets or sets the label of the item |
AccessibleLabel | String | Gets or sets the automation name that will be set on the item. If not set, Label will be used. |
Command | ICommand | Gets or sets the command associated to the item. If null, the item will be displayed as a text field. If set, the item will be displayed as an hyperlink. |
CommandParameter | Object | Gets or sets the parameter that will be provided to the Command |
MetadataControl sample page Source.
You can see this in action in Windows Community Toolkit Sample App.