WPF C# Tutorial

     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  
    
    
      
      
    

    
      
    

    
    
                      HorizontalAlignment="Left" Header="My Expander" 
                ExpandDirection="Down" IsExpanded="True" Width="100">
        
          this is a test
        
      
    
    
    
      
        Click to change the ExpandDirection property on My Expander
      
      
                          IsChecked="True"
                  Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
           Expand Down
        
                          Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
           Expand Up
        
                          Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
          Expand Left
        
                          Checked="ChangeExpandDirection"
                  GroupName="ExpandDirectionProperty">
          Expand Right
        
      

    
  


//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.Navigation;
using System.Windows.Shapes;
namespace ExpanderDirectionExample
{
    public partial class Page1 : Page
    {
        private void ChangeExpandDirection(object sender, RoutedEventArgs e)
        {
            if ((Boolean)ExpandDown.IsChecked)
                myExpander.ExpandDirection = ExpandDirection.Down;
            else if ((Boolean)ExpandUp.IsChecked)
                myExpander.ExpandDirection = ExpandDirection.Up;
            else if ((Boolean)ExpandLeft.IsChecked)
                myExpander.ExpandDirection = ExpandDirection.Left;
            else if ((Boolean)ExpandRight.IsChecked)
                myExpander.ExpandDirection = ExpandDirection.Right;
            myExpander.IsExpanded = true;
        }
    }
}