Reputation: 322
I want to check position of a Windows Store app when it's in snapped state (left or right of the screen) by code. If it's on the left, I do something. If it's on the right, I do something else.
How to do it?
Upvotes: 1
Views: 462
Reputation: 8852
I don't think you can detect which side the App is snapped to. You can detect if app is snapped, filled, FullScreenLandscape and FullScreenPortrait and that's about it.
Windows.UI.ViewManagement namespace doesn't provide any function for position of snapped state.
Update
As Jim O'Neil said, following code works perfectly.
if (Windows.UI.ViewManagement.ApplicationView.Value == Windows.UI.ViewManagement.ApplicationViewState.Snapped)
{
if (Window.Current.Bounds.Left == 0)
// snapped left
else
// snapped right
}
Upvotes: 0
Reputation: 23754
Check the Left edge of the Current window in conjunction with the ApplicationView
if (Windows.UI.ViewManagement.ApplicationView.Value == Windows.UI.ViewManagement.ApplicationViewState.Snapped)
{
if (Window.Current.Bounds.Left == 0)
// snapped left
else
// snapped right
}
Upvotes: 2