WPF C# Tutorial

      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      x:Class="WpfApplication1.Page1"
      WindowTitle="Docking Sample">
  
    
      Dock = "Left"
      Dock = "Right"
      Dock = "Top"
      Dock = "Bottom"
      Dock = "Left"
      Dock = "Right"
      Dock = "Top"
      Dock = "Bottom"
      LastChildDock="True"
      LastChildDock="False"
    
    
      
        
        
      
    
  

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Navigation;
namespace WpfApplication1
{
    public partial class Page1 : Page
    {
        public void OnClick1(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect1, Dock.Left);
        }
       
        public void OnClick2(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect1, Dock.Right);
        }
        public void OnClick3(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect1, Dock.Top);
        }
        public void OnClick4(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect1, Dock.Bottom);
        }
        public void OnClick5(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect2, Dock.Left);
        }
        public void OnClick6(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect2, Dock.Right);
        }
        public void OnClick7(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect2, Dock.Top);
        }
        public void OnClick8(object sender, RoutedEventArgs e)
        {
            DockPanel.SetDock(rect2, Dock.Bottom);
        }
        public void OnClick9(object sender, RoutedEventArgs e)
        {
            AnotherDockPanel.LastChildFill = true;
        }
        public void OnClick10(object sender, RoutedEventArgs e)
        {
            AnotherDockPanel.LastChildFill = false;
        }
    }
}