I Need pass the Value to child Window.In child window there is two Text boxes.I need to show the value in child window Text box while while its getting opened.
I tried the following way,My Child window class as follows,
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;
}
}
My Parent Window as follows,
private void EditButton_Click(System.Object sender, System.Windows.RoutedEventArgs e)
{
ChildWindow child= new ChildWindow();
child.abc = 1;
child.alue = "Hello"
child.show();
}
How can I show the child window controls with values (which is getting from Parent) while its getting opened?
You can change the following:
To:
The problem in your code is, the properties are being assigned during initialization of the control. Not when the properties has been changed.