title: Using CreateParams and SetWindowTheme on a ListView at the same time
body: <p>I'm using the SetWindowTheme function (uxtheme.dll) to make my ListView look like Windows 7 native.
  I had to use the CreateParams stuff to prevent that ListView flickering when I sort it.
  It worked, but when I use that CreateParams code, the SetTheme doesn't work anymore.
  Is there a way to use the Windows 7 native theme and the CreateParams at the same time ?</p>
  
  <pre><code>protected override CreateParams CreateParams
  {
      get
      {
          CreateParams cp = base.CreateParams;
          cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
          return cp;
      }
  }
  
  
  [DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
      private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);
  
  public MainWindow()
  {
      InitializeComponent();
      SetWindowTheme(listView1.Handle, "Explorer", null);
  }
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>EDIT :</strong>
  I solved the problem by adding a SetWindowTheme call in the OnHandleCreated void of my custom ListView. Thanks to <em>Hans Passant</em>.</p>