TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
WPF: How to display content in an Expander
Nipun Tomar
Dec 16, 2011
35.6
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
The following XAML demonstrates how to use two Expander objects.
The following XAML demonstrates how to use two
Expander
objects.The first
Expander
expands horizontally and uses an image in its header. The second
Expander
contains a set of
System.Windows.Controls.Button
objects and expands downward.
XAML CODE:
<
Window
x
:
Class
="Expander.MainWindow"
xmlns
=
http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns
:
x
=
http://schemas.microsoft.com/winfx/2006/xaml
Title
="MainWindow"
Height
="200"
Width
="300">
<
ScrollViewer
HorizontalScrollBarVisibility
="Auto"
VerticalScrollBarVisibility
="Auto">
<
StackPanel
HorizontalAlignment
="Left">
<
Expander
ExpandDirection
="Right"
IsExpanded
="True">
<
Expander.Header
>
<
Image
Source
="Apress.gif"/>
</
Expander.Header
>
<
TextBlock
TextWrapping
="Wrap"
MaxWidth
="200">
Windows Presentation Foundation (WPF) is the presentation
subsystem feature of the .NET Framework 4.0,that provide good
design and advance controls. Silverlight
i
s the Subset of
WPF.
Through WPF we can create Windows and WebBrowser Application.
</
TextBlock
>
</
Expander
>
<
Expander
Header
="Buttons">
<
StackPanel
>
<
StackPanel
Orientation
="Horizontal">
<
Button
Content
="Button 1"
Margin
="2"/>
<
Button
Content
="Button 2"
Margin
="2"/>
<
Button
Content
="Button 3"
Margin
="2"/>
<
Button
Content
="Button 4"
Margin
="2"/>
<
Button
Content
="Button 5"
Margin
="2"/>
</
StackPanel
>
<
StackPanel
HorizontalAlignment
="Left">
<
Button
Content
="Button A"
Margin
="2" />
<
Button
Content
="Button B"
Margin
="2" />
<
Button
Content
="Button C"
Margin
="2" />
<
Button
Content
="Button D"
Margin
="2" />
<
Button
Content
="Button E"
Margin
="2" />
</
StackPanel
>
</
StackPanel
>
</
Expander
>
</
StackPanel
>
</
ScrollViewer
>
</
Window
>
Next Recommended Reading
WPF: Content Presenter