【发布时间】:2015-07-27 05:04:30
【问题描述】:
我需要将值传递给子窗口。在子窗口中有两个文本框。我需要在子窗口文本框打开时显示该值。
我尝试了以下方式,My Child窗口类如下,
public partial class ChildWindow:ChildWindow
{
public int abc {get;set;}
public string value{get;set;}
public ChildWindow()
{
InitializeComponent();
this.txtbox1.Text = abc ;
this.txtbox2.Text = value;
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
}
我的父窗口如下,
private void EditButton_Click(System.Object sender, System.Windows.RoutedEventArgs e)
{
ChildWindow child= new ChildWindow();
child.abc = 1;
child.alue = "Hello"
child.show();
}
如何在子窗口控件打开时显示带有值(从父窗口获取)的子窗口控件?
【问题讨论】:
标签: c# winforms silverlight silverlight-3.0 silverlight-5.0