How to dynamically create and display buttons in a WPF window?

How to dynamically create and display buttons in the window? A window created through "Project" - "Add a window".
Everywhere are encouraged to use "this.Controls.Add(button)". But:
"MainWindow" does not contain a definition of "Controls" and failed to find an available extension method "Controls" host type "MainWindow" as the first argument (possibly missing a using Directive or an Assembly reference).

Yes, and do not understand what is this and where it all happens.
/**********************/
// Opening window, and generating the buttons is by pressing the button, i.e. this event
 int itemsCount = 5;
 int buttonMargin= 20;
 int left = 10;
 int top = 10;
 for(int i=1; i != itemsCount; i++)//Output buttons in a loop
{
 System.Windows.Forms.Button button = new the System.Windows.Forms.Button(); //Create buttons
 button.Left = left;
 button.Name = "TEST";
 button.Top = top + buttonMargin;
this.Controls.Add(button);//?
 top += button.Height;
}
Window1 win = new Window1();
win.Show();
/**********************/
April 3rd 20 at 17:16
1 answer
April 3rd 20 at 17:18
Solution
Use an ItemsPresenter, it will override the ItemTemplate.
But even better go to pattern MVVM and do it all via Binding.

Find more questions by tags WPFC#