WPF C# Tutorial

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="NonRectangularWindowSample" SizeToContent="WidthAndHeight" 
  MouseLeftButtonDown="NonRectangularWindow_MouseLeftButtonDown"
  WindowStyle="None" 
  AllowsTransparency="True" 
  Background="Transparent">
  
    
      
        
          
          
          
          
        
      

      
        
          
            
            
            
            
            
            
            
            
          
        

      

    
    Drag Me
    
      
        
          
            
              
                
              

            
            
            
          

        

      

    
  

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Input;
namespace NonRectangularWindowSample {
  public partial class NonRectangularWindow : Window {
    public NonRectangularWindow() {
      InitializeComponent();
    }
    void NonRectangularWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
      this.DragMove();
    }
    void closeButtonRectangle_Click(object sender, RoutedEventArgs e) {
      this.Close();
    }
  }
}