Answer: Add a close button in child window in code

Jul 9, 2015 at 7:40 PM
This is my solution to add a close button in the child window this was based in others posts:

In User control (Child window) to this:

Add a MdiChild Object
MdiChild view;
Add a MdiChild parameter
public CustomerMaster(MdiChild _view)
Assing the parameter to MdiChid object
view = _view;
Add a button and in the click method add this code
private void button1_Click(object sender, RoutedEventArgs e)
At main container where you want to launch the child window do this:

Add a MdiChild object
MdiChild nueva = new MdiChild();
Add a new instance of the child windows (user control) and sent like parameter value the previous object
CustomerMaster VentClientes = new CustomerMaster(nueva);
Set to the MdiChild the required porperties and set the Content to the new instance of child window
            nueva.Title = "  Child Window";
            nueva.Height = 300;
            nueva.Width = 300;
            nueva.Content = VentClientes;
Launch the child window
I hope this be to somen usefull,.
Marked as answer by acastrejon on 7/9/2015 at 11:41 AM