Пример #1
0
        private static void OnWindowSourceInitialized(object sender, System.EventArgs e)
        {
            Window window = (Window)sender;

            System.IntPtr hWnd = new WindowInteropHelper(window).Handle;
            ControlBox.UpdateStyle(window, hWnd);
            ControlBox.UpdateExtendedStyle(window, hWnd);
            window.SourceInitialized -= new System.EventHandler(ControlBox.OnWindowSourceInitialized);
        }
Пример #2
0
        private static void OnControlBoxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Window window = d as Window;

            if (window != null)
            {
                System.IntPtr hWnd = new WindowInteropHelper(window).Handle;
                if (hWnd == System.IntPtr.Zero)
                {
                    window.SourceInitialized += new System.EventHandler(ControlBox.OnWindowSourceInitialized);
                }
                else
                {
                    ControlBox.UpdateStyle(window, hWnd);
                    ControlBox.UpdateExtendedStyle(window, hWnd);
                }
            }
        }