Browse Source
Merge pull request #9214 from AvaloniaUI/fixes/devtools-with-no-theme
Fix DevTools when application does not include a theme.
pull/9216/head
Dariusz Komosiński
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
3 deletions
-
src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml
-
src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs
-
src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs
|
|
|
@ -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"> |
|
|
|
<Window.DataTemplates> |
|
|
|
<diag:ViewLocator/> |
|
|
|
</Window.DataTemplates> |
|
|
|
|
|
|
|
@ -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<RawKeyEventArgs>() |
|
|
|
.Where(x => x.Type == RawKeyEventType.KeyDown) |
|
|
|
|
|
|
|
@ -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)) |
|
|
|
{ |
|
|
|
|