2014-06-27 100 views
0

的文本标签我有这样定义的按钮:如何更改工具栏按钮

 <Button x:Name="ButtonPlayMax" 
      Click="ButtonPlayMax_Click" 
      Style="{StaticResource PlayVideoAppBarButtonStyle}" 
      HorizontalAlignment="Center" 
      VerticalAlignment="Bottom" 
      FontSize="17.333" 
      Margin="0"/> 

     <Style x:Key="PlayVideoAppBarButtonStyle" 
      TargetType="ButtonBase" 
      BasedOn="{StaticResource AppBarButtonStyle}"> 
      <Setter Property="AutomationProperties.AutomationId" 
       Value="PlayVideoAppBarButton" /> 
      <Setter Property="AutomationProperties.Name" 
       Value="Play" /> 
      <Setter Property="Content" 
       Value="&#xE102;" /> 
     </Style> 

按钮的文本标签设置为“播放”。

有没有办法在代码中将文本标签动态更改为“停止”,或者我将不得不定义第二个按钮并在它们之间切换?

Thx

+1

你会为按钮设置一个新的文本属性,即ButtonPlayMax.Text =“blah” –

+1

我认为你需要在样式Play ...和Stop ..之间切换,不仅仅是文本。 –

+0

我倾向于认为,当我尝试简单的解决方案时,需要在样式之间切换...... –

回答

0

IL_Agent的答案是正确的。我确实改变了风格。两种风格的区别仅仅是PLAY和STOP所需的文本。对不起,不要提前关闭此问题。