Windows Phone 获取窗口大小

For Windows Phone Apps, if you have to get the windows size, first you have to wait for the page being loaded completed, then you can get the window size by Application.Current.RootVisual.RenderSize;

Best Practise:

In Page Constructor, add event like below:

 this.Loaded += MainPage_Loaded;

Then in MainPage_Loaded method, get the window size, then adjust your controls ' size there.

            Size windowSize = Application.Current.RootVisual.RenderSize;
            double windowWidth = windowSize.Width;
            double windowHeight = windowSize.Height;
原文地址:https://www.cnblogs.com/qixue/p/2993880.html