Link to home
Start Free TrialLog in
Avatar of Dinesh Subramanian
Dinesh SubramanianFlag for United Arab Emirates

asked on

adding a stackpanel control to expander programmatically in WPF

hi,
How to add a stackpanel control to expander control programmatically
Here is the code
private void button1_Click(object sender, RoutedEventArgs e)
        {
            Expander exp1 = new Expander();
            StackPanel sp1 = new StackPanel();
            Button newBtn = new Button();
            newBtn.Content = "A New Button";
            sp1.Children.Add(newBtn);

// Here I want to add the sp1 (StackPanel) to the exp1 (Expander)

            wrapPanel1.Children.Add(exp1);
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of buraksarica
buraksarica
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial