Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Can I detect a theme change in a custom visual?

When I switch the theme in Power BI Desktop, it triggers a refresh of my custom visual. In my visual's Update method is there a way to tell whether the current refresh has been triggered because of a change in theme?

  • Hi Anonymous,

    The VisualUpdateType enum in the API, doesn't have an event for a theme change. I expect that because themes can potentially cause changes in property defaults (and this can include properties in custom visuals), this would be the same as manually triggering a property update in the pane, which would be VisualUpdateType.All in the update options.

    Regards,

    Daniel

3 Replies

  • dm-p's avatar
    dm-p
    Icon for Super User rankSuper User

    Hi Anonymous,

    The VisualUpdateType enum in the API, doesn't have an event for a theme change. I expect that because themes can potentially cause changes in property defaults (and this can include properties in custom visuals), this would be the same as manually triggering a property update in the pane, which would be VisualUpdateType.All in the update options.

    Regards,

    Daniel

    • Anonymous's avatar
      Anonymous
      Not applicable

      As I feared. Ah well. Thanks for the confirmation!

      • dm-p's avatar
        dm-p
        Icon for Super User rankSuper User

        I probably should have added in my original reply, that you could try requesting it to be added to the API. It might be constrained by the underlying limitations of Power BI, but it never hurts to ask, as it might be possible for the team to expose for you if they can.