locked
UISettings.ColorValuesChanged RRS feed

  • Question

  • I'm trying to capture the Windows.UI.ViewManagement.UISettings.ColorValuesChanged event to determine when the user changes the system accent color in Settings.

    I add an event handler delegate, but it doesn't get called.  I get that this is a broadcast event from a different process, but if it's in the API then one would think it would work? Maybe? Sometimes?

    Monday, January 25, 2016 2:44 AM

All replies

  • Hi CinSoft

    I used the following code and  also found the ColorValuesChanged  event was not called after accent color is changed in UWP:

    new UISettings().ColorValuesChanged += this.OnColorValuesChanged;


    Sometimes I found the ColorValuesChanged  event was called after Background was changed from “Picture” to “Solid color”.

    If I do not misunderstand you, I wonder if you want to detect whether Accent Color changed, if so, please try use

    (Color)Application.Current.Resources["SystemAccentColor"] 

    in a timer to detect wheher its value changed.
    If I have misunderstood you, please feel free to let me know.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 26, 2016 8:53 AM
  • You have indeed understood, but having a continuous running timer polling for changes to "System Accent Color" seems like a huge cost to work around what is essentially a Windows bug.

    How about just getting a fix for the bug onto the priority list? 

    I know (boy do I know!) that QA has been a very low priority in Windows 10 development, but you'd think that having the UWA API work as designed (and documented) would be somewhere in the top 10 priorities?  (Perhaps?  Maybe?  Even above finishing the sketchy documentation?  Although somewhere below finishing the mail client?)

    Thanks for the suggestion, I'll try using it.

    BTW - Is there anything in the API that will allow an app to detect a change to Application::Current.Resources.ThemeDictionaries?  That would be another way to detect if the user changed the system theme.

    BTW2 - Also, I have noticed that when the accent color changes there is a ListView in my app that refreshes itself 3 times in a row, and quite obviously at that (flash! flash! flash!).  What's that about?  Obviously IT knows something happened (and is a bit freaked by it).  So much for a smooth seamless user experience.

    Tuesday, January 26, 2016 5:48 PM
  • There is something quite non-intuitive about UISettings as an event source. Unlike some other WinRT types that implicitly act as singletons (e.g. SystemNavigationManager.GetForCurrentView().BackRequested), the UISettings instance must remain in scope for the events to be delivered.

    In the above code, the instance of UISettings goes out of scope immediately since no reference is held to it. If you create a member variable in one of your app classes and assign the new UISettings instance to it, then you will continue to get events until that reference is released.

    Friday, March 4, 2016 12:48 AM
  • I gave up on this one, but figured a reply would be useful.

    So I changed my code to keep a reference to UISettings, but still no getting the event.

    I tried an event handler with a member method, a static method, and a lambda, and no joy with any of them.

    Just letting everyone know - this problem is NOT resolved.

    Friday, May 27, 2016 12:41 PM