在Silverlight中显示动态文本 [英] showing dynamic text in silverlight

查看:85
本文介绍了在Silverlight中显示动态文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮,显示单击我!"在上面.我想看到当我单击按钮时,它显示请勿单击我!"

I have a button which shows "click me!" on it. I want to see that when I click on the button, it shows "Do not click on me!"

我的Search.xaml文件中有一个按钮,如下所示,它始终显示单击我!".

I have a button in my Search.xaml file like below and it always show "click me!".

<Button x:Name="buttonname" Canvas.Top="60" Canvas.Left="30" Click="btnTest_Click" Content="click me!"></Button>

我的Search.xaml.cs也如下所示:

Also my Search.xaml.cs looks like below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;

namespace TMTemplate
{
    public partial class Search : Page
    {
        public Search() { 
            InitializeComponent();
        }
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            this.Content = "Do not click on me!";
        }   
    }
}

这是行不通的,我花了很多时间来解决这个问题,请您让我知道如何使它正常工作...

This is not working and I have spent lots of time to figure this out, Would you please let me know how I can get it working...

非常感谢您.

推荐答案

this.Content = "Do not click on me!";

应该是

buttonname.Content = "Do not click on me!";

这篇关于在Silverlight中显示动态文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆