High-Performance Development - C#, VB, SQL, ASP.NET

Slogan Text

Here's how to dynamically add objects to a StackPanel in code-behind:

On our XAML page add a StackPanel tag and add a x:Name attrribute:

    <stackpanel horizontalalignment="Left" x:name="Stack1">

In the code-behind create the new element and add it to the Children collection:

    public MainPage()
        TextBox TextObj;


        TextObj = new TextBox();
        TextObj.Width = 100;