Click here to Skip to main content
16,017,238 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to close the child window from the MDI container.
The collections of child windows were generated. I found difficult to point out the Child windows number in the collection.
Posted
Comments
Albin Abel 21-Feb-11 1:21am    
i think you need to keep global name value pair collection in the MDI parent. Name would be a unique name and value would be a reference to the child window. Using this you can identify the child using the name like Childrens["my_child_1"].close();
Seth007 10-Mar-11 10:00am    
Are you sure you are using Wpf? If so, we need to know how you implemented the MDI functionality in the first place.

C#
foreach (Form f in this.MdiChildren)
   f.Close()


now if u want to close Specific window u can try somthing like

C#
foreach (Form f in this.MdiChildren)
{
     if(f.Name =="Some text")
        f.close();
}
 
Share this answer
 
Hope Multiple Window Interface for WPF[^]article from CP might help you.
 
Share this answer
 
Comments
[no name] 21-Feb-11 5:11am    
Let me know the reason for 2 Vote.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900