

void OnLoaded(object sender, RoutedEventArgs e) In the following example, the frame is extended into the client area on the Loaded event of the window. In WPF, the window handle can be obtained from the Handle property of an HwndSource. To use the DwmExtendFrameIntoClientArea function, a window handle must be obtained. MARGINS is used to tell the DWM how much extra the frame should be extended into the client area. It takes two parameters a window handle and a MARGINS structure. Public Shared Function DwmExtendFrameIntoClientArea(ByVal hwnd As IntPtr, ByRef pMarInset As MARGINS) As IntegerĭwmExtendFrameIntoClientArea is the DWM function that extends the frame into the client area. Public cyBottomHeight As Integer ' height of bottom border that retains its size Public cyTopHeight As Integer ' height of top border that retains its size Public cxRightWidth As Integer ' width of right border that retains its size Public cxLeftWidth As Integer ' width of left border that retains its size Public static extern int DwmExtendFrameIntoClientArea( Public int cyBottomHeight // height of bottom border that retains its size Public int cyTopHeight // height of top border that retains its size Public int cxRightWidth // width of right border that retains its size Public int cxLeftWidth // width of left border that retains its size Each of these API are declared in a class called NonClientRegionAPI.
#Wpf extended menu code
The following code example does a Platform Invoke (pinvoke) for the two API needed to extend the frame into the client area. To extend the glass frame on a WPF application, access to unmanaged API is needed. The following image illustrates the glass frame extended into the address bar of Internet Explorer 7:
#Wpf extended menu windows
Areas that would typically render with the transparent glass effect on other editions of Windows Vista are rendered opaque. Windows Vista Home Basic edition does not support the transparent glass effect. This example will only work on a Windows Vista machine running the Desktop Window Manager (DWM) with glass enabled.
