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

Commit 0a75a7e

Browse files
committed
Don't define ResourceDictionary.Source in XamlDesign config
The XAML designer don't work correctly if a implementation of `ResourceDictionary` defines a `Source` property.
1 parent 4f7df35 commit 0a75a7e

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

GitHubVS.sln

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ Global
163163
{346384DD-2445-4A28-AF22-B45F3957BD89}.Release|Any CPU.Build.0 = Release|Any CPU
164164
{346384DD-2445-4A28-AF22-B45F3957BD89}.Release|x86.ActiveCfg = Release|Any CPU
165165
{346384DD-2445-4A28-AF22-B45F3957BD89}.Release|x86.Build.0 = Release|Any CPU
166-
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
167-
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
166+
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|Any CPU.ActiveCfg = XamlDesign|Any CPU
167+
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|Any CPU.Build.0 = XamlDesign|Any CPU
168168
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|x86.ActiveCfg = Debug|Any CPU
169169
{346384DD-2445-4A28-AF22-B45F3957BD89}.XamlDesign|x86.Build.0 = Debug|Any CPU
170170
{158B05E8-FDBC-4D71-B871-C96E28D5ADF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -528,8 +528,8 @@ Global
528528
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|Any CPU.Build.0 = Release|Any CPU
529529
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|x86.ActiveCfg = Release|Any CPU
530530
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|x86.Build.0 = Release|Any CPU
531-
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
532-
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
531+
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.ActiveCfg = XamlDesign|Any CPU
532+
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.Build.0 = XamlDesign|Any CPU
533533
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|x86.ActiveCfg = Release|Any CPU
534534
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|x86.Build.0 = Release|Any CPU
535535
{50E277B8-8580-487A-8F8E-5C3B9FBF0F77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

src/GitHub.UI/Helpers/LoadingResourceDictionary.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace GitHub
99
{
1010
public class LoadingResourceDictionary : ResourceDictionary
1111
{
12+
#if !XAML_DESIGNER // XAML Designer doesn't work if `Source` property has been replaced.
1213
static Dictionary<string, Assembly> assemblyDicts = new Dictionary<string, Assembly>();
1314

1415
public new Uri Source
@@ -71,5 +72,6 @@ static string FindAssemblyNameFromPackUri(Uri packUri)
7172

7273
return path.Substring(1, componentIndex - 1);
7374
}
75+
#endif
7476
}
7577
}

src/GitHub.UI/Helpers/SharedDictionaryManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace GitHub.UI.Helpers
66
{
77
public class SharedDictionaryManager : LoadingResourceDictionary
88
{
9+
#if !XAML_DESIGNER // XAML Designer doesn't work if `Source` property has been replaced.
910
static readonly Dictionary<Uri, ResourceDictionary> resourceDicts = new Dictionary<Uri, ResourceDictionary>();
1011

1112
Uri sourceUri;
@@ -25,5 +26,6 @@ public class SharedDictionaryManager : LoadingResourceDictionary
2526
resourceDicts.Add(value, this);
2627
}
2728
}
29+
#endif
2830
}
2931
}

src/GitHub.VisualStudio.UI/Helpers/SharedDictionaryManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace GitHub.VisualStudio.UI.Helpers
88
{
99
public class SharedDictionaryManager : LoadingResourceDictionary
1010
{
11+
#if !XAML_DESIGNER // XAML Designer doesn't work if `Source` property has been replaced.
1112
public SharedDictionaryManager()
1213
{
1314
currentTheme = Colors.DetectTheme();
@@ -16,7 +17,6 @@ public SharedDictionaryManager()
1617
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
1718
string currentTheme;
1819

19-
#if !XAML_DESIGNER
2020
static readonly Dictionary<Uri, ResourceDictionary> resourceDicts = new Dictionary<Uri, ResourceDictionary>();
2121
static string baseThemeUri = "pack://application:,,,/GitHub.VisualStudio.UI;component/Styles/";
2222

src/GitHub.VisualStudio/Helpers/SharedDictionaryManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace GitHub.VisualStudio.Helpers
77
{
88
public class SharedDictionaryManager : LoadingResourceDictionary
99
{
10+
#if !XAML_DESIGNER // XAML Designer doesn't work if `Source` property has been replaced.
1011
static readonly Dictionary<Uri, ResourceDictionary> resourceDicts = new Dictionary<Uri, ResourceDictionary>();
1112

1213
Uri sourceUri;
@@ -26,5 +27,6 @@ public class SharedDictionaryManager : LoadingResourceDictionary
2627
resourceDicts.Add(value, this);
2728
}
2829
}
30+
#endif
2931
}
3032
}

0 commit comments

Comments
 (0)