lentinant
lentinant

Reputation: 832

Window border thickness when changing from Maximized to Normal

I have WPF application, which main window state I want to change from Maximized to Normal, while keeping actual size. But there is one issue - for some reason (probably default behavior), after switching to Normal state, window always gets 1px border thickness. I can fix this by assigning BorderThickness property of window manually, right after setting WindowState to Normal, but it causes visible flickering. Moreover, if moving from Normal back to Maximized, and then back to Normal, window still gets border thickness, even if it was set to 0 before.

Is there any way to remove this default behavior for getting border thickness when switching to Normal?

Upvotes: 0

Views: 374

Answers (1)

PMF
PMF

Reputation: 17278

Make sure you directly update the BorderThickness propery inside a callback from changing the window state, like the StateChanged or SizeChanged events. This should remove the flickering.

Hint: You might confuse users with this behavior. Maybe it would be better not to allow maximizing in the first place. Or hide the window frame completelly.

Upvotes: 1

Related Questions