WPF C# Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SimpleStack" Height="223" Width="354" MinWidth="50">
  
    
      A Button Stack
    
    Button 1
    Button 2
    Button 3
    Button 4
         Checked="chkVertical_Checked" Unchecked="chkVertical_Unchecked">
      Use Vertical Orientation            
  

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace LayoutPanels
{
    public partial class SimpleStack : Window
    {
        public SimpleStack()
        {
            InitializeComponent();
        }
        private void chkVertical_Checked(object sender, RoutedEventArgs e)
        {
            stackPanel1.Orientation = Orientation.Horizontal;
        }
        private void chkVertical_Unchecked(object sender, RoutedEventArgs e)
        {
            stackPanel1.Orientation = Orientation.Vertical;
        }
    }
}