Well, you DrawThemeBackgroundneed a device context descriptor, which is a pure Win32 concept ... WPF does not use device contexts or window handles. However, the WPF application is hosted in a Win32 window, and you can get the HWND of this window:
using System.Windows.Interop;
...
IntPtr hwnd = new WindowInteropHelper(this).Handle;
Then you can get the DC for this window using the GetDC API:
[DllImport("user32.dll")]
static extern IntPtr GetDC(IntPtr hWnd);
...
IntPtr hdc = GetDC(hwnd);
Then you should use DrawThemeBackgroundDC with this.
Please note that this is all purely theoretical, I have not tested it ...
source
share