<Setter Property=Template>
<Setter.Value>
<ControlTemplate TargetType=customControls:PlaceholderTextButton>

<Grid
Background={ThemeResource ApplicationPageBackgroundThemeBrush}>
<Border
<Grid>
…
<TextBlock
x:Name=PlaceholderText
Text={TemplateBinding PlaceholderText}
2. Set an accessible name on a list item
Depending on how you populate the data shown in your list items, you may find the accessible name of your list items is exactly the same as your C# class name used to manage the items. To expose that to your customer would make the list unusable.
The easiest way to avoid this is to return a useful accessible name for the list item by overriding the ToString() function of whatever class youve added for the list items. The following example shows the accessible name being set from a single view model property called PlantName.
The following example shows the accessible name being set as a formatted string based on multiple view model properties:
public override string ToString()
{
return this.PlantName;
}
The following example shows the accessible name being set as a formatted string based on multiple view model properties:
public override string ToString()
{
return string.Format(

this.stringResources.PlantListItemAccessibleNameFormat,
this.Genus,
this.Name,
this.Colour);
}
3. Set an accessible name in code-behind
If for some reason it is not practical to set the accessible name on an element through XAML, then it can be done in code-behind. For example:
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-49289-2.html
身材好