The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

[UWP][Xaml] How does auto accent color works in Windows? RRS feed

  • Question

  • Hello guys,

    I am trying to make an app where the user can select custom background for the app, and i want the app colors change depending on the selected background, just like auto accent color in Windows.
    does anyone has any idea on how to achieve that?

    Saturday, September 29, 2018 11:55 AM

All replies

  • Hi,

    Well, I'm not sure if I misunderstand your question. If you want to change the background color to what the customer wants, a possible way is that you could defined all the colors you need to use in the controls as color resources in the App.Xaml. Then you could change the color resource once you need to change them in the code behind.

    I made a simple code demo about this:


            <!--it is a brush that I used in mainpage-->
            <SolidColorBrush x:Key="TestThemeColor" Color="Red"> </SolidColorBrush>


     <Grid Background="{ThemeResource TestThemeColor}">
            <Button Click="Button_Click" Content="Click"/>


     public MainPage()
            private void Button_Click(object sender, RoutedEventArgs e)
                //change the resource and then the mainpage will change to blue
                (Application.Current.Resources["TestThemeColor"] as SolidColorBrush).Color = Windows.UI.Colors.Blue;

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, October 1, 2018 5:54 AM