我有下一个用户控件:
<UserControl
x:Class="Test.Views.NavigationMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RTUforWindows8.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<UserControl.Resources>
<Style x:Key="HomeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="HomeAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="ewffgwefwfwefwefwe"/>
<Setter Property="Content" Value=""/>
</Style>
</UserControl.Resources>
<StackPanel Orientation="Horizontal">
<Button
Style="{StaticResource HomeAppBarButtonStyle}" />
<Button
Style="{StaticResource AppBarButtonStyle}" />
</StackPanel>
在我的代码中,我想更改:
<Setter Property="AutomationProperties.Name" Value="ewffgwefwfwefwefwe"/>
对某事的价值,我做:
NavigationMenu NM = new NavigationMenu();
var style = (NM.Resources["HomeAppBarButtonStyle"] as Style).Setters[1];
并且无法弄清楚如何输入设置此值?
这应该怎么看: