How to get the device orientation changed event under Windows Phone

后端 未结 1 1786
清酒与你
清酒与你 2021-01-16 08:37

With windows phone, is there an event I can register for when the device entered landscape mode?

The reason why I am asking this is because we have a view with an i

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 09:18

    Your best bet would be describing to Windows.Current.SizeChanged event and testing if width is more than height. There is also a sensor for this, but is is a bit problematic, take a look at http://www.jayway.com/2014/10/06/detecting-orientation-in-universal-apps-windows-phone-8-1/.

    .xaml

    
    
        <--! Other Code -->
    
    
    

    .cs

    private void SizeChangedEvent(object sender, SizeChangedEventArgs e)
    {
    }
    

    0 讨论(0)
提交回复
热议问题