From 323e006837a600cf763704773a052339e4ebcf84 Mon Sep 17 00:00:00 2001 From: Alexandre Zollinger Chohfi Date: Fri, 17 Sep 2021 11:12:44 -0700 Subject: [PATCH] Fix for DefaultStyleKey not working always when assembly name differs from namespace. --- .../CameraPreview/CameraPreview.cs | 1 + .../DropShadowPanel/DropShadowPanel.cs | 1 + CommunityToolkit.WinUI.UI.Controls.Core/ImageEx/ImageEx.cs | 1 + .../InAppNotification/InAppNotification.cs | 1 + CommunityToolkit.WinUI.UI.Controls.Core/Loading/Loading.cs | 1 + CommunityToolkit.WinUI.UI.Controls.Core/Menu/Menu.cs | 1 + .../MetadataControl/MetadataControl.cs | 1 + .../RadialProgressBar/RadialProgressBar.cs | 1 + .../RotatorTile/RotatorTile.cs | 1 + .../TabbedCommandBar/TabbedCommandBar.cs | 2 +- .../TabbedCommandBar/TabbedCommandBarItem.cs | 1 + .../TextToolbar/TextToolbar.cs | 1 + .../TileControl/TileControl.cs | 1 + 13 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/CameraPreview/CameraPreview.cs b/CommunityToolkit.WinUI.UI.Controls.Core/CameraPreview/CameraPreview.cs index 99cb2a111..94d1672b7 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/CameraPreview/CameraPreview.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/CameraPreview/CameraPreview.cs @@ -77,6 +77,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public CameraPreview() { this.DefaultStyleKey = typeof(CameraPreview); + this.DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); } /// diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/DropShadowPanel/DropShadowPanel.cs b/CommunityToolkit.WinUI.UI.Controls.Core/DropShadowPanel/DropShadowPanel.cs index 3f2d567dd..420c96dff 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/DropShadowPanel/DropShadowPanel.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/DropShadowPanel/DropShadowPanel.cs @@ -33,6 +33,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public DropShadowPanel() { this.DefaultStyleKey = typeof(DropShadowPanel); + this.DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode) { diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/ImageEx/ImageEx.cs b/CommunityToolkit.WinUI.UI.Controls.Core/ImageEx/ImageEx.cs index 7e63ab4b9..717fe658a 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/ImageEx/ImageEx.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/ImageEx/ImageEx.cs @@ -18,6 +18,7 @@ namespace CommunityToolkit.WinUI.UI.Controls : base() { DefaultStyleKey = typeof(ImageEx); + DefaultStyleResourceUri = new System.Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); } } } \ No newline at end of file diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/InAppNotification/InAppNotification.cs b/CommunityToolkit.WinUI.UI.Controls.Core/InAppNotification/InAppNotification.cs index 8f053ac4a..0e226d521 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/InAppNotification/InAppNotification.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/InAppNotification/InAppNotification.cs @@ -35,6 +35,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public InAppNotification() { DefaultStyleKey = typeof(InAppNotification); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); _dismissTimer = _dispatcherQueue.CreateTimer(); diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/Loading/Loading.cs b/CommunityToolkit.WinUI.UI.Controls.Core/Loading/Loading.cs index e56cb1d03..aa6065999 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/Loading/Loading.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/Loading/Loading.cs @@ -23,6 +23,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public Loading() { DefaultStyleKey = typeof(Loading); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); } /// diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/Menu/Menu.cs b/CommunityToolkit.WinUI.UI.Controls.Core/Menu/Menu.cs index cb929172b..bcc55661b 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/Menu/Menu.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/Menu/Menu.cs @@ -24,6 +24,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public Menu() { DefaultStyleKey = typeof(Menu); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); } // even if we have multiple menus in the same page we need only one cache because only one menu item will have certain short cut. diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/MetadataControl/MetadataControl.cs b/CommunityToolkit.WinUI.UI.Controls.Core/MetadataControl/MetadataControl.cs index 9f7ce8c19..ca4e39bda 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/MetadataControl/MetadataControl.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/MetadataControl/MetadataControl.cs @@ -65,6 +65,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public MetadataControl() { DefaultStyleKey = typeof(MetadataControl); + DefaultStyleResourceUri = new System.Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); ActualThemeChanged += OnActualThemeChanged; } diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/RadialProgressBar/RadialProgressBar.cs b/CommunityToolkit.WinUI.UI.Controls.Core/RadialProgressBar/RadialProgressBar.cs index f86bb4b08..f5b087a52 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/RadialProgressBar/RadialProgressBar.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/RadialProgressBar/RadialProgressBar.cs @@ -119,6 +119,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public RadialProgressBar() { DefaultStyleKey = typeof(RadialProgressBar); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); SizeChanged += SizeChangedHandler; } diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/RotatorTile/RotatorTile.cs b/CommunityToolkit.WinUI.UI.Controls.Core/RotatorTile/RotatorTile.cs index c6baceff7..b8c31c84e 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/RotatorTile/RotatorTile.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/RotatorTile/RotatorTile.cs @@ -84,6 +84,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public RotatorTile() { DefaultStyleKey = typeof(RotatorTile); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); Unloaded += RotatorTile_Unloaded; Loaded += RotatorTile_Loaded; diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBar.cs b/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBar.cs index 6ffa98f94..51f52dd75 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBar.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBar.cs @@ -38,7 +38,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public TabbedCommandBar() { DefaultStyleKey = typeof(TabbedCommandBar); - DefaultStyleResourceUri = new System.Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); SelectionChanged += SelectedItemChanged; Loaded += TabbedCommandBar_Loaded; diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBarItem.cs b/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBarItem.cs index 8d62cf3c1..eb283db40 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBarItem.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/TabbedCommandBar/TabbedCommandBarItem.cs @@ -23,6 +23,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public TabbedCommandBarItem() { DefaultStyleKey = typeof(TabbedCommandBarItem); + DefaultStyleResourceUri = new System.Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); } /// diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/TextToolbar/TextToolbar.cs b/CommunityToolkit.WinUI.UI.Controls.Core/TextToolbar/TextToolbar.cs index fc77da5ce..ead47df52 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/TextToolbar/TextToolbar.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/TextToolbar/TextToolbar.cs @@ -30,6 +30,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public TextToolbar() { DefaultStyleKey = typeof(TextToolbar); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); CustomButtons = new ButtonMap(); ButtonModifications = new DefaultButtonModificationList(); diff --git a/CommunityToolkit.WinUI.UI.Controls.Core/TileControl/TileControl.cs b/CommunityToolkit.WinUI.UI.Controls.Core/TileControl/TileControl.cs index ffa1a24ed..e802947c4 100644 --- a/CommunityToolkit.WinUI.UI.Controls.Core/TileControl/TileControl.cs +++ b/CommunityToolkit.WinUI.UI.Controls.Core/TileControl/TileControl.cs @@ -66,6 +66,7 @@ namespace CommunityToolkit.WinUI.UI.Controls public TileControl() { DefaultStyleKey = typeof(TileControl); + DefaultStyleResourceUri = new Uri("ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml"); InitializeAnimation(); }