Solved

adding a stackpanel control to expander programmatically in WPF

Posted on 2010-11-24
1
2,253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

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

Open in new window

0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Upgrading my SSIS package in VS 2012 6 84
MYSQL responding very slow 3 48
Retrieve Active Directory Groups a User belongs to in VB.NET 3 43
Problem to Office 1 40
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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