Share Pastebin
Guest
Public paste!

Creating a WPF DockPanel using XAML

By: a guest | Mar 18th, 2010 | Syntax: XML | Size: 1.68 KB | Hits: 42 | Expires: Never
Copy text to clipboard
  1. <Window x:Class="WpfDockPanelExample.Window1"
  2.   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.   Title="Sundeepan's DockPanel Example">
  5.    
  6.     <DockPanel LastChildFill="True">
  7.         <TextBlock DockPanel.Dock="Left"
  8.                  VerticalAlignment="Center"
  9.                  Background="Bisque"
  10.                  Foreground="DarkGoldenrod"
  11.                  FontFamily="Veranda"
  12.                  FontSize="20">
  13.             I am the left!</TextBlock>
  14.         <TextBlock DockPanel.Dock="Right"
  15.                  VerticalAlignment="Center"
  16.                  Background="DarkGoldenrod"
  17.                  Foreground="Bisque"
  18.                  FontFamily="Veranda"
  19.                  FontSize="20"
  20.                  TextAlignment="Center">
  21.            I am the right!</TextBlock>
  22.         <TextBlock DockPanel.Dock="Top"
  23.                  Background="OliveDrab"
  24.                  Foreground="Cornsilk"
  25.                  FontFamily="Veranda"
  26.                  FontSize="20"
  27.                  TextAlignment="Center">
  28.             w00h00, look at me, im on top of the world!!!!</TextBlock>
  29.         <TextBlock DockPanel.Dock="Bottom"
  30.                  Background="Cornsilk"
  31.                  Foreground="OliveDrab"
  32.                  FontFamily="Veranda"
  33.                  FontSize="20"
  34.                  TextAlignment="Center">
  35.             aww shucks, I am on the bottom now..in the pits!!!!</TextBlock>
  36.        
  37.         <Button Height="40" Width="200" Click="Button_Click" Background="LightBlue">
  38.             I am the fill!("Press me!")
  39.         </Button>            
  40.  
  41.     </DockPanel>              
  42.  
  43. </Window>