Solved

adding a stackpanel control to expander programmatically in WPF

Posted on 2010-11-24
1
2,216 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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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

10 Experts available now in Live!

Get 1:1 Help Now