From 6cc1215989ad440bc989a730956e6e51ee7d674e Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 17 Oct 2022 15:13:40 +0200 Subject: [PATCH 1/5] Initialize DevTools MainWindow theme in code. Previously if no theme was included in App.xaml, then DevTools would fail to open because the `StaticResource` lookup would fail due to the window's XAML not being parsed yet. --- src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml | 3 +-- .../Diagnostics/Views/MainWindow.xaml.cs | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml index 1270dbaa62..d2b31fdb20 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml @@ -3,8 +3,7 @@ xmlns:views="clr-namespace:Avalonia.Diagnostics.Views" xmlns:diag="clr-namespace:Avalonia.Diagnostics" Title="Avalonia DevTools" - x:Class="Avalonia.Diagnostics.Views.MainWindow" - Theme="{StaticResource {x:Type Window}}"> + x:Class="Avalonia.Diagnostics.Views.MainWindow"> diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs b/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs index c81997f2cb..e6e630112b 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs @@ -28,6 +28,11 @@ namespace Avalonia.Diagnostics.Views { InitializeComponent(); + // Apply the SimpleTheme.Window theme; this must be done after the XAML is parsed as + // the theme is included in the MainWindow's XAML. + if (Theme is null && this.FindResource(typeof(Window)) is ControlTheme windowTheme) + Theme = windowTheme; + _keySubscription = InputManager.Instance?.Process .OfType() .Where(x => x.Type == RawKeyEventType.KeyDown) From 2435d2e87b585832f76fb7ad7f5b1e397dd49789 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 17 Oct 2022 15:34:22 +0200 Subject: [PATCH 2/5] Fix DataGrid cell contents lookup in DevTools. --- .../MarkupExtensions/StaticResourceExtension.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs index d462a2210e..f28f7bc626 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs @@ -56,7 +56,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions // We need to implement compile-time merging of resource dictionaries and this // hack can be removed. if (previousWasControlTheme && - parent is ResourceDictionary hack && + parent is IResourceProvider hack && hack.Owner?.GetType().FullName == "Avalonia.Diagnostics.Views.MainWindow" && hack.Owner.TryGetResource(ResourceKey, out value)) { From 8dab69663f649d75312e23ba173374d931f933b0 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Tue, 18 Oct 2022 00:42:48 +0800 Subject: [PATCH 3/5] fix: fix caption button fluent theme and default theme. --- .../Controls/CaptionButtons.xaml | 10 +++++----- .../Controls/CaptionButtons.xaml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml index c91e008e02..e06fa0c8d4 100644 --- a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml @@ -41,7 +41,7 @@ Theme="{StaticResource FluentCaptionButton}" IsVisible="False"> - @@ -61,7 +61,7 @@ - @@ -80,17 +80,17 @@ - - - diff --git a/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml b/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml index 379b92ea17..1badffef33 100644 --- a/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml +++ b/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml @@ -47,7 +47,7 @@ Theme="{StaticResource SimpleCaptionButton}"> - @@ -69,7 +69,7 @@ - @@ -89,17 +89,17 @@ - - - From 3184252633e0c7828c340eacf57920ecbda230ad Mon Sep 17 00:00:00 2001 From: rabbitism Date: Tue, 18 Oct 2022 01:24:35 +0800 Subject: [PATCH 4/5] fix: revert FullScreenButtonPath. --- src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml | 4 ++-- src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml index e06fa0c8d4..3b1071b36a 100644 --- a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml @@ -41,7 +41,7 @@ Theme="{StaticResource FluentCaptionButton}" IsVisible="False"> - @@ -83,7 +83,7 @@ - diff --git a/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml b/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml index 1badffef33..8c263d0231 100644 --- a/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml +++ b/src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml @@ -47,7 +47,7 @@ Theme="{StaticResource SimpleCaptionButton}"> - @@ -92,7 +92,7 @@ - From 2f124a9a480e8a20373531d4e605d096572fc669 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Tue, 18 Oct 2022 01:31:08 +0800 Subject: [PATCH 5/5] fix: align with naming convention. --- src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml | 4 ++-- src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml index 3b1071b36a..71ae012289 100644 --- a/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml @@ -61,7 +61,7 @@ - @@ -80,7 +80,7 @@ -