Solved

adding a stackpanel control to expander programmatically in WPF

Posted on 2010-11-24
1
2,246 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:Dinesh Subramanian
1 Comment
 
LVL 5

Accepted Solution

by:
buraksarica earned 500 total points
ID: 34204710
exp1.Content = sp1;

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question