返回首页

您好
请帮助我的要求是当我点击一个按钮,它shoult显示一些文本,在文本框中的其他用户控制
的第一个用户控制我的代码是followes请更正

我的主页

<Page x:Class="test.Page2"

      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

      xmlnsBig Grin | :-D ="http://schemas.microsoft.com/expression/blend/2008"

      mc:Ignorable="d"

      d:DesignHeight="300" d:DesignWidth="300"

      xmlns:ucl="clr-namespace:test"

    Title="Page2">

 

    <Grid>

        <ucl:UserControl1></ucl:UserControl1>

        <ucl:UserControl2 Loaded="UserControl2_Loaded"></ucl:UserControl2>

    </Grid>

</Page>
我UserControl1.xaml

{C} 我的UserControl1.xaml.cs
namespace test

{

    /// <summary>

    /// Interaction logic for UserControl1.xaml

    /// </summary>

    public partial class UserControl1 : UserControl,INotifyPropertyChanged

    {

        public UserControl1()

        {

            InitializeComponent();

        }

        public event PropertyChangedEventHandler PropertyChanged;

        private string n;

        public string name

        {

            get { return n; }

            set { n = value;

            OnPropertyChanged("name");

            }

        }

        protected void OnPropertyChanged(string name)

        {

            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)

            {

                handler(this, new PropertyChangedEventArgs(name));

            }

        }

    }

}
我UserControl2.xaml

{体C3} 我的UserControl2.xaml.cs

{的C4}:7962316 |会员

回答

评论会员: 时间:2
1