Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Conversation

@krschau
Copy link
Collaborator

@krschau krschau commented Mar 14, 2024

Summary of the pull request

If the user updated the system theme while the Add Widget dialog was open, the dialog would not update. This change fixes the problem by:

  • Update the dialog itself. Before we were setting the RequestedTheme to be the ActualTheme, which meant if the RequestedTheme was Default, it would not update when the Default changed.
  • Update the widget preview image by listening to ActualThemeChanged and swapping out the image.
  • Update the widget icons by listening to ActualThemeChanged and swapping out the Content of the menu items.

This change has the nice side-effect of decoupling the AddWidgetView and the DashboardView, by requiring the DashboardView to pass in the dispatcherQueue or ActualTheme anymore. It will also make it easier to move more logic from the AddWidget View to ViewModel in the future if we want to.

References and relevant issues

Detailed description of the pull request / Additional comments

Validation steps performed

PR checklist

{
foreach (var widgetItem in providerItem.MenuItems.Cast<NavigationViewItem>())
{
var widgetDefinition = widgetItem.Tag as WidgetDefinition;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to try catch widget definition usage, or we don't expect RPC errors here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yes, I think we should, but I think the only way to do this without making the whole dashboard a mess of try/catches is to wrap the widget objects in a model so we don't have to be querying the real objects the entire time (which I do plan to do at some point).

@AmelBawa-msft AmelBawa-msft added the Needs-Second Pull request that needs another approval label Mar 14, 2024
@krschau krschau force-pushed the user/krschau/addwidget-theme2 branch from 7147f08 to 09ecc5e Compare March 19, 2024 15:51
@krschau krschau merged commit 96810ec into main Mar 20, 2024
@krschau krschau deleted the user/krschau/addwidget-theme2 branch March 20, 2024 18:10
@krschau krschau removed the Needs-Second Pull request that needs another approval label Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Widget dialog doesn't respond to theme changes while open

5 participants