0
votes

I have a WPF window with ResizeMode="NoResize" WindowStyle="None". I have a custom title bar made with a Grid and a px border that wraps the whole window. I am using the following for resizing the window

HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
SendMessage(source.Handle, WM_SYSCOMMAND, (IntPtr)(61440 + direction), IntPtr.Zero);

where direction is

public enum SysCommandSize : int {
     SC_SIZE_HTLEFT = 1,
     SC_SIZE_HTRIGHT = 2,
     SC_SIZE_HTTOP = 3,
     SC_SIZE_HTTOPLEFT = 4,
     SC_SIZE_HTTOPRIGHT = 5,
     SC_SIZE_HTBOTTOM = 6,
     SC_SIZE_HTBOTTOMLEFT = 7,
     SC_SIZE_HTBOTTOMRIGHT = 8
}

Everything works fine except when sizing by grabbing any part of the bottom or top to make the height smaller than the initial window height. What happens is the bottom border ends up disappearing.

Does any one have any idea what is going on here?

Thanks

1

1 Answers

0
votes

I got around this problem by using the WPF Custom Chrome Library workaround for creating a window with a custom border and title bar. I was able to customize the window to the way I want. I am still working out a few kinks but everything works a lot better now. Thanks to gbahns.