0

I have a child window of type:

Xceed.Wpf.Toolkit.ChildWindow

and my main window is of type System.Windows.Window How can I programmatically all my child window into my Main window?

nima
  • 11
  • 4
  • The answer is actually on the Extended WPF Toolkit guide. – Amaury Levé Oct 21 '16 at 11:35
  • 1
    @Evangelink I found only this page in the documentation but it seems there is no mention about programmatically loading a childWindow http://wpftoolkit.codeplex.com/wikipage?title=ChildWindow&referringTitle=Documentation – nima Oct 24 '16 at 01:46
  • Actually ,it says the main window type should be of type WindowContainer – nima Oct 24 '16 at 02:18

1 Answers1

0

I found the solution: in your xaml of main window:

<Window x:Class="WpfApplicationTestChildWindow.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplicationTestChildWindow"
        xmlns:xceed="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
        xmlns:primitive="clr-namespace:Xceed.Wpf.Toolkit.Primitives;assembly=Xceed.Wpf.Toolkit"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <primitive:WindowContainer Name="cntr1">
        </primitive:WindowContainer>
    </Grid>
</Window>

and in the code behind:

using System.Windows;
namespace WpfApplicationTestChildWindow
{
    public partial class Window2 : Window
    {
        public Window2()
        {
            InitializeComponent();
            ChildWindow1 child1 = new ChildWindow1();
            cntr1.Children.Add(child1);
            child1.Show();
        }
    }
}
nima
  • 11
  • 4