Is there a way to add a control like in Win Forms C# Button b = new Button();
and then add it just like Form1.Controls.Add(b);
I can't do this in WPF because I don't have a Controls attribute in the Window class. How can I do this. I read this of just putting a Panel, dock it to fill and then there I use this:
myPanel.Children.Add(b);
But then it comes to me again. How do I create and add a Panel and dock it to fill?
If I use Panel p = new Panel();
it marks error. And how do I add the panel to my MainWindow?