Search content within the blog

Friday, December 2, 2011

Epander control in WPF - Exmaple

Just copy paste the code. it is self explanatory.

XAML

<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Expender WPF Sample" Height="300" Width="400"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Expander HorizontalAlignment="Left" Header="Standard Expander"
VerticalAlignment="Top" ExpandDirection="Down" Width="150">
<TextBlock TextWrapping="Wrap" Background="AntiqueWhite">
This is the standard expander
behavior. The expander opens
and the controls below it
move down.
</TextBlock>
</Expander>
<StackPanel Grid.Row="1" Margin="10,5,0,0">
<RadioButton Content="Choice One"/>
<RadioButton Content="Choice Two"/>
<RadioButton Content="Choice Three"/>
</StackPanel>
</Grid>

<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="33" />
<RowDefinition />
</Grid.RowDefinitions>
<Canvas Panel.ZIndex="99">
<Expander HorizontalAlignment="Left" Header="PopUp Window Expander"
VerticalAlignment="Top" ExpandDirection="Down" Width="175">
<Grid Background="Cornsilk">
<Grid.BitmapEffect>
<DropShadowBitmapEffect />
</Grid.BitmapEffect>

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock Text="How Cool Is This!" FontWeight="Bold"
Margin="5"/>
<TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">
This is the popup expander
behavior. The expander opens
and overlays the controls
below it.
</TextBlock>
</Grid>
</Expander>
</Canvas>
<StackPanel Grid.Row="1" Margin="10,5,0,0">
<RadioButton Content="Choice One"/>
<RadioButton Content="Choice Two"/>
<RadioButton Content="Choice Three"/>
</StackPanel>
</Grid>
</Grid>
</Window>



OUTPUT


No comments:

Post a Comment