0

コントロール テンプレートが 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 テキストを動的に変更したい..??これを行う方法.?

4

1 に答える 1

0

ボタン アクション コードに次の行を追加します。

x.Text = "Text Box content";

元:

private void Button_Click_2(object sender, RoutedEventArgs e)
{
x.Text = "Text Box content";
  }

ボタン コントロールについては、その記事をご覧ください。

http://www.silverlightshow.net/items/Button-Controls-in-Silverlight-2-Beta-1.aspx

于 2013-01-23T14:52:57.373 に答える