Scott Ferguson
Scott Ferguson

Reputation: 7830

How do I set an orientation specific background in a Windows Store Application?

I have a Windows Store Application where I've been supplied a different background image asset depending on whether the app is running in Portrait or Landscape mode.

Other than this background image, there are no other orientation specific differences.

What is the tidiest way to implement this requirement?

Upvotes: 0

Views: 74

Answers (1)

w.b
w.b

Reputation: 11228

You can set it in Window.Current.SizeChanged handler:

Window.Current.SizeChanged += (sender, args) =>
{
    if (ApplicationView.Value == ApplicationViewState.FullScreenLandscape)
    {
        // ...
    }
    else if (ApplicationView.Value == ApplicationViewState.FullScreenPortrait)
    {
        // ...
    }
};

Upvotes: 2

Related Questions