Define a GridSplitter and Vertical Alignment Changed : GridSplitter « Windows Presentation Foundation « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Windows Presentation Foundation » GridSplitter 
16.37.6.Define a GridSplitter and Vertical Alignment Changed
<Window x:Class="GridSplitter_Example.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="GridSplitter Example">
<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Name="Col0" />
    <ColumnDefinition Name="Col1" />
    <ColumnDefinition Name="Col2" />
    <ColumnDefinition Name="Col3" />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Name="Row0" />
    <RowDefinition Name="Row1" />
    <RowDefinition Name="Row2" />
  </Grid.RowDefinitions>

  <StackPanel Grid.Row="0" Grid.Column="0" Background="Orange">
    <TextBlock>Row Col 0</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="1" Grid.Column="0" Background="Blue">
    <TextBlock>Row Col 0</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="2" Grid.Column="0" Background="Green">
    <TextBlock>Row Col 1</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="0" Grid.Column="1" Background="Purple">
    <TextBlock>Row Col 1</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="1" Grid.Column="1" Background="Red">
    <TextBlock>Row Col 1</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="2" Grid.Column="1" Background="Salmon">
   <TextBlock>Row Col 1</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="0" Grid.Column="2" Background="MediumVioletRed">
    <TextBlock>Row Col 2</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="1" Grid.Column="2" Background="SteelBlue">
    <TextBlock>Row Col 2</TextBlock>
  </StackPanel>
  <StackPanel Grid.Row="2" Grid.Column="2" Background="Olive">
    <TextBlock>Row Col 2</TextBlock>
  </StackPanel>
   
  <GridSplitter Name="myGridSplitter" Grid.Column="1" Grid.Row="1" Width="5"/>
  <StackPanel Grid.Column="3" Grid.RowSpan="3" Background="Brown">
    <TextBlock FontSize="14" Foreground="Yellow">Property Settings</TextBlock>

    <StackPanel Margin="0,5,0,0">
      <TextBlock>VerticalAlignment</TextBlock>
      <RadioButton Name="VerticalAlignmentTop" Checked="VerticalAlignmentChanged" GroupName="VerticalAlignmentProperty">
        Top
      </RadioButton>
      <RadioButton Name="VerticalAlignmentBottom" Checked="VerticalAlignmentChanged" GroupName="VerticalAlignmentProperty">
        Bottom
      </RadioButton>
      <RadioButton Name="VerticalAlignmentCenter" Checked="VerticalAlignmentChanged" GroupName="VerticalAlignmentProperty">
        Center
      </RadioButton>
      <RadioButton Name="VerticalAlignmentStretch" Checked="VerticalAlignmentChanged" IsChecked="true" GroupName="VerticalAlignmentProperty">
        Stretch (default)
      </RadioButton>
    </StackPanel>
  </StackPanel>
</Grid>
</Window>
//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 GridSplitter_Example
  Public Partial Class Window1
    Inherits Window
    Public Sub New()
      InitializeComponent()
    End Sub
    Private Sub VerticalAlignmentChanged(sender As Object, e As RoutedEventArgs)
      If CType(VerticalAlignmentTop.IsChecked, [Boolean]) Then
        myGridSplitter.VerticalAlignment = VerticalAlignment.Top
      ElseIf CType(VerticalAlignmentBottom.IsChecked, [Boolean]) Then
        myGridSplitter.VerticalAlignment = VerticalAlignment.Bottom
      ElseIf CType(VerticalAlignmentCenter.IsChecked, [Boolean]) Then
        myGridSplitter.VerticalAlignment = VerticalAlignment.Center
      ElseIf CType(CType(VerticalAlignmentStretch.IsChecked, [Boolean])[Boolean]) Then
        myGridSplitter.VerticalAlignment = VerticalAlignment.Stretch
      End If
    End Sub
  End Class
End Namespace
WPF Define A Grid Splitter And Vertical Alignment Changed
16.37.GridSplitter
16.37.1.Define a GridSplitter and ShowsPreview ChangedDefine a GridSplitter and ShowsPreview Changed
16.37.2.GridSplitter and ResizeBehaviorChangedGridSplitter and ResizeBehaviorChanged
16.37.3.Define a GridSplitter and Resize Direction ChangedDefine a GridSplitter and Resize Direction Changed
16.37.4.Define a GridSplitter and Keyboard IncrementDefine a GridSplitter and Keyboard Increment
16.37.5.GridSplitter and DragIncrement ChangedGridSplitter and DragIncrement Changed
16.37.6.Define a GridSplitter and Vertical Alignment ChangedDefine a GridSplitter and Vertical Alignment Changed
16.37.7.Define a GridSplitter and Horizontal Alignment ChangedDefine a GridSplitter and Horizontal Alignment Changed
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.