C# WPF SizeChanged event doesn't update width and height when maximized

痞子三分冷 提交于 2019-12-30 09:48:10

问题


I was trying to update my controls when the size of the form changed using SizeChanged.

It worked perfectly, except when going full screen.

I searched the grid events but couldn't find any events that occur when the user maximizes the window (goes full screen).


回答1:


I was able to receive SizeChanged event on maximize:

private void window1_SizeChanged(object sender, SizeChangedEventArgs e)
{
    var a = window1.ActualHeight;
    var b = window1.ActualWidth;
    var c = window1.Height;
    var d = window1.Width;
}

And these are values for window Height and Width:

a = 838.4
b = 1550.4
c = 350.4
d = 524.8



来源:https://stackoverflow.com/questions/32668707/c-sharp-wpf-sizechanged-event-doesnt-update-width-and-height-when-maximized

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!