我有一個控制模板爲stackpanel的按鈕。在stackpanel裏面有textblock。我懷疑如何動態地改變那個文本塊的文本。更改按鈕控件模板內的文本塊文本的內容..?
<Button x:Name="Animate" Width="auto" Height="25" Click="Button_Click_2" Content="Close">
<Button.Template>
<ControlTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="AnimateTextBlock" Text="Actions" VerticalAlignment="Center" FontSize="14"></TextBlock>
<Image Source="/HB.EmployeeInfo;component/Images/Actions.png" Width="20" Height="20"></Image>
</StackPanel>
</ControlTemplate>
</Button.Template>
</Button>
我要動態地改變AnimateTextBlock文字??如何做到這一點?
這你嘗試過的方式?動態地在代碼或xaml中? –