title: Custom window style with minimize animation
body: <p>I wanted to have a customized window so followed a few tutorials which enable this by setting the window style to none, and then adding the title-bar/restore/minimize/close buttons yourself. The minimize is achieved by simply handling the click event and setting the Window-state to minimized, but this doesn't show the minimize animation you see on Windows 7, and just instantly hides the window, which feels very odd when used with other windows that do animate, as you tend to feel the application is closing.</p>
  
  <p>So, is there anyway of enabling that animation? .. it seems to be disabled when you change the WindowStyle to none.</p>
  
  <p>Edit : Test code </p>
  
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          WindowStyle = WindowStyle.None;
          InitializeComponent();
      }
  
      [DllImport("user32.dll")]
      static extern int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
  
      protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
      {
          base.OnMouseLeftButtonDown(e);
  
          // this doesnt seem to animate
          SendMessage(new WindowInteropHelper(this).Handle, 0x0112, (IntPtr)0xF020, IntPtr.Zero);
      }
  
      protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
      {
          base.OnMouseRightButtonDown(e);
  
          WindowStyle = WindowStyle.SingleBorderWindow;
          WindowState = WindowState.Minimized;
      }
  
      protected override void OnActivated(EventArgs e)
      {
          base.OnActivated(e);
  
          Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =&gt; WindowStyle = WindowStyle.None));
      }
  }
  </code></pre>