DockPanel and Grid : DockPanel « Windows Presentation Foundation « C# / CSharp Tutorial






<Window x:Class="StackPanelDemo.DockandGrid"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="DockGridDemo" Height="446" Width="535">
    <Grid>
      <DockPanel MinHeight="50" MinWidth="50" LastChildFill="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="0" Grid.RowSpan="1" Margin="10,10,22,21" Width="NaN" Height="NaN" Name="dockPanel1">
        <Button Name="button1" DockPanel.Dock="Top">I am the toolbar</Button>
        <Button Name="button2" DockPanel.Dock="Bottom">I am the status bar</Button>
        <Button Name="button3">I am the left toolbox</Button>
        <Button Name="button4" DockPanel.Dock="Right">I am the right toolbox</Button>
        <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="0.1*"  />
          <RowDefinition Height="0.8*" />
          <RowDefinition Height="0.1*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.1*" />
          <ColumnDefinition Width="0.7*" />
          <ColumnDefinition Width="0.1*" />
        </Grid.ColumnDefinitions>
          <StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Orientation="Horizontal">
            <Label>Your Name:</Label>
            <TextBox>Enter Name Here</TextBox>
            <Button>...</Button>
          </StackPanel>
        </Grid>

      </DockPanel>
    </Grid>
  </Window>
WPF Dock Panel And Grid








24.57.DockPanel
24.57.1.DockPanel with TextBlockDockPanel with TextBlock
24.57.2.DockPanel and GridDockPanel and Grid
24.57.3.Put a Menu and toolbar on the top with DockPanelPut a Menu and toolbar on the top with DockPanel
24.57.4.Put a simple StatusBar on the bottom with DockPanelPut a simple StatusBar on the bottom with DockPanel
24.57.5.DockPanel FillDockPanel Fill
24.57.6.DockPanel with Menu, ToolBarTray, StatusBar, StackPanelDockPanel with Menu, ToolBarTray, StatusBar, StackPanel
24.57.7.LayoutPanels Basic Dialog BoxLayoutPanels Basic Dialog Box
24.57.8.Dock more than two objectsDock more than two objects
24.57.9.Docking left and right before top and bottomDocking left and right before top and bottom
24.57.10.Show the effect of each value of the Dock property by manipulating two Rectangle elements.Show the effect of each value of the Dock property by manipulating two Rectangle elements.
24.57.11.Dock list box at left of panel
24.57.12.Dock Around the Block