I want to check if the user has set a light or dark theme. Is it possible to do so programmatically in Windows Phone 8.1 (store app).
相关问题
- WP8.1 How to cancel a Background Audio Task in C#
- windows phone 8.1 music library get current media
- Listview applies a check to other listview items h
- Microsoft store certification fails due to DPI awa
- Uwp: Xaml Parse Error with Target Device Family De
相关文章
- How to create a MediaClip from RenderTargetBitmap
- Show flyout using BottomAppBar
- How to overlay items in StackPanel or ListView?
- C# UWP Toolkit DropShadowPanel inner shadow
- Could not find a suitable SDK to target
- await Task.CompletedTask for what?
- How to create a square button?
- Edge: In-Process native extension and Windows.Syst
To check which theme is active you can use RequestedTheme property of the Application object MSDN
Here at MSDN you will find sample codes, which you can use to determine the current theme - by comparing resources. For example:
But - I've enocuntered some problems running the above line at WP8.1 Runtime - it couldn't find the requested key. As it turned out - the above code will work only on WP8.1 Silverlight (also WP8.0).
But (again), nothing stands on your way to define your own ThemeResource and check it's state:
In app.xaml - define some ThemeResources:
Then you can use for example a property in your code:
Note also that in some cases you may need to check for HighContrast - according to MSDN, you can do it by checking AccessibilitySettings class or extend your own created ThemeResource by HighContrast values.