Use the Expander control and set the ExpandDirection property : Expander « Windows Presentation Foundation « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Windows Presentation Foundation » ExpanderScreenshots 
Use the Expander control and set the ExpandDirection property
Use the Expander control and set the ExpandDirection property
   

<Page x:Class="ExpanderDirectionExample.Page1"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>
    
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="200"/>
      <ColumnDefinition Width="150"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition/>
    </Grid.RowDefinitions>
    
    <StackPanel Grid.Column="0" Grid.Row="0">
      <Expander Name="myExpander" Background="Tan" 
                HorizontalAlignment="Left" Header="My Expander" 
                ExpandDirection="Down" IsExpanded="True" Width="100">
        <TextBlock TextWrapping="Wrap">
          this is a test
        </TextBlock>
      </Expander>
    </StackPanel>
    
    <StackPanel Grid.Column="1" Grid.Row="0">
      <TextBlock Margin="0, 10, 3, 3" FontSize="12" TextWrapping="Wrap">
        Click to change the ExpandDirection property on My Expander
      </TextBlock>
      <StackPanel>
        <RadioButton Name="ExpandDown" Margin="0,10,0,10" 
                  IsChecked="True"
                  Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
           Expand Down
        </RadioButton>
        <RadioButton Name="ExpandUp" Margin="0,0,0,10"
                  Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
           Expand Up
        </RadioButton>
        <RadioButton Name="ExpandLeft" Margin="0,0,0,10"
                  Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
          Expand Left
        </RadioButton>
        <RadioButton Name="ExpandRight" Margin="0,0,0,10"
                  Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
          Expand Right
        </RadioButton>
      </StackPanel>
    </StackPanel>
  </Grid>
</Page>


//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Navigation
Imports System.Windows.Shapes

Namespace ExpanderDirectionExample
  Public Partial Class Page1
    Inherits Page
    Private Sub ChangeExpandDirection(sender As Object, e As RoutedEventArgs)
      If CType(ExpandDown.IsChecked, [Boolean]) Then
        myExpander.ExpandDirection = ExpandDirection.Down
      ElseIf CType(ExpandUp.IsChecked, [Boolean]) Then
        myExpander.ExpandDirection = ExpandDirection.Up
      ElseIf CType(ExpandLeft.IsChecked, [Boolean]) Then
        myExpander.ExpandDirection = ExpandDirection.Left
      ElseIf CType(ExpandRight.IsChecked, [Boolean]) Then
        myExpander.ExpandDirection = ExpandDirection.Right
      End If

      myExpander.IsExpanded = True
    End Sub
  End Class
End Namespace

   
    
    
  
Related examples in the same category
1.Display Content in an ExpanderDisplay Content in an Expander
2.Multi Direction ExpandersMulti Direction Expanders
3.Use ExpanderUse Expander
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.