in vb6 i can easily get the value from childwindow to another childwindow.. for example frm1.textbox1.text = frm2.listview.item.selectedindex… how can i do this in wpf?
i have two child window named EmployeProfile and the other one is PrintEmpProfile… in EmployeeProfile window, there is a listview… what i want is if I’m going to click the print button, i can get the value from EmployeeProfile listview….
so far this is what’s I’ve got. this code is inside of PrintEmpProfile
DataTable table = new DataTable("EmpIDNumber");
table.Columns.Add("IDNum", typeof(string));
for (int i = 1; i <= 100; i++)
{
table.Rows.Add(new object[] { EmployeeProfile.????? });
}
i don’t know how to get all values from EmployeeProfile listview.
Whenever you open a child window put a reference of the new child window into a collection. I ssume that MyChild is your child window defined in XAML like:
You can define a static list holding your child windows in App.xaml.cs
Whenever you open child window add it into this collection like:
You should also remove child from this collection when you close your child window. You can do this in Closed event of the window. Define closed vent in XML:
And in code behind:
Whenever a child window wants to access ListView of other child window then it gets reference of the child from the collection and then call ListView defined in XAML directly.