is there a way to add a user control to a WPF Window created in code? I cant find a Children property in the Window Class. In xaml It would look like this:
<Window x:Class="MyWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:MyUserControls="clr-namespace:MyUserControls"
Title="" Height="Auto" Width="550" ResizeMode="NoResize">
<MyUserControls:UC1 x:Name="uc1" />
</Window>
In code I tried something like this:
Window myWindow = new Window;
UC1 uc1 = new UC1;
myWindow.Children.Add(UC1);
Thanks for your help