Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF layout on a Window

I have a couple of listboxes on a WPF Windows, with Height="Auto" Width="Auto" set on the form

The form sizes perfectly on different resolutions, but the problem is that when I press the maximise button a thick "Black L" is visible while the form resizes. I have seen this on quite a few WPF applications, but not had to solve the problem till now.

Is there a way to DoubleBuffer the Window, or call SuspendLayout() in WPF while the controls on the form are resized? How can I get rid of this ugly black L?

like image 622
Vault Avatar asked Sep 10 '09 16:09

Vault


1 Answers

Quoting one of the recent Hanselminutes:

Ian Griffiths: ... There's the win32 cue which is an ordinary win32 message loop, and WPF pools messages off of that and puts them on it's own cue and then deal with it on it's own sweet time, partly because it wants to be able to reorder the events as they come in. It will prioritize certain things above input processing, for example, and that, by the way, is why you get the slightly bizarre repaint handling on resizing WPF applications, you may have noticed you get a little bit of blank space appearing temporarily when you resize a window it's because it's acknowledging the resize event before it actually really does anything with it and then the paints happen slightly out of sync with what's normally there. So there is a win32 message queue but it's not actually the main message queue in WPF and that‘s all sort of implementation details the dispatcher tries to hide as much about it as possible.

It seems relevant to your problem, though I'm not aware of a complete solution. Maybe, you should try to change some Dispatcher priorities?

like image 143
Max Galkin Avatar answered Oct 05 '22 02:10

Max Galkin