How can I get a screen resolution of Device (Windows Phone)

前端 未结 4 1981
南方客
南方客 2020-12-20 13:39

How can I get a screen resolution of Device from settings (Windows Phone) ?

4条回答
  •  猫巷女王i
    2020-12-20 14:20

    This actually requires a combination of @Dmitriy Reznik and @Paras Wadehra's answers, as the dimensions exposed by Host.Content are the unscaled dimensions.

    var content = App.Current.Host.Content;
    
    var screenResolution = new Size(
        content.ActualWidth*content.ScaleFactor/100,
        content.ActualHeight*content.ScaleFactor/100);
    

提交回复
热议问题