Solved

adding a stackpanel control to expander programmatically in WPF

Posted on 2010-11-24
1
2,184 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:dinudany
1 Comment
 
LVL 5

Accepted Solution

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

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now