I am just in the process of teaching myself WPF. I have reached the point of adding controls dynamically and have hit a brick wall on something really simple. I code that should create a button (shown below):
Button button = new Button() { Height = 80, Width = 150, Content = "Test" };
parentControl.Add(button);
My question is what is parentControl
actually called? I am using the standard Visual Studio 2012 WPF template and my main window is called MainWindow
. I have no objects in the Window besides what comes in the template
So far I have looked at:
- WPF runtime control creation
- Dynamic control creation in WPF
- WPF MVVM Dynamic control creation
- Dynamic creation of control
- Where should I put WPF specific code when using MVVM?
- Steps Of Control Creation Process WPF
- Where to put code in (primarily) windowless WPF app?
The closest I have found it: WPF runtime control creation.
All of these questions just assume you know such a basic thing but I don't. Please help.