2014-06-27 101 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所需的文本。對不起,不要提前關閉此問題。