Posts

Showing posts from February, 2006

Custom Chrome in WPF

Image
Some of you may have wondered who the creators of Microsoft Max did the Chrome. Although this breaks one of the Top 10 Vista rules I will show how to create a WPF window with custom chrome. You can't get there by simply setting the border of a WPF Window to None because always a thick border remains. You have to do a work around and create an empty Win32 window and fill it with your own WPF controls. You can use the HwndSource object to do this. This object is intended to place WPF controls into Win32 Applications but you can also use it to place a WPF control onto your Windows Desktop which is also a Win32 application. HwndSource will call the native function CreateWindowEx and create the window for you. Dim params As HwndSourceParameters = New HwndSourceParameters("CustomChrome 1", 400, 300) Dim hwnd As HwndSource = New HwndSource(params) hwnd.RootVisual = New Page1 This code will create a default window for you. The HwndSourceParameters 's constructor sets the