我有一个应用栏按钮,我想通过代码隐藏动态更改它下面显示的文本。我尝试更改其Content属性,但它会更改图标。
我无法在stackoverflow上找到答案,也无法通过互联网找到答案......
感谢您的帮助。
答案 0 :(得分:4)
在代码中,写下以下内容:
AutomationProperties.SetName(myAppBarButton, "New text");
如果您查看标题的工作方式,他们会为此目的“劫持”AutomationProperties.Name
附加属性,然后将其绑定在内部。
答案 1 :(得分:0)
转到standardstylesheet.xaml并添加一个新密钥,就像已经找到的密钥一样!
<Style x:Key="SkipBackAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="SkipBackAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Skip Back"/>
<Setter Property="Content" Value=""/>
</Style>