From 8720fc9c2765fc07ea1cde591dea0cf70bdcbf25 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Mon, 7 Aug 2023 18:05:13 +0200 Subject: [PATCH] fix: AvaloniaVS can not resolve resource relative path in Previewer --- src/Avalonia.DesignerSupport/DesignWindowLoader.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.DesignerSupport/DesignWindowLoader.cs b/src/Avalonia.DesignerSupport/DesignWindowLoader.cs index c248116614..0a901ae798 100644 --- a/src/Avalonia.DesignerSupport/DesignWindowLoader.cs +++ b/src/Avalonia.DesignerSupport/DesignWindowLoader.cs @@ -29,7 +29,7 @@ namespace Avalonia.DesignerSupport if (assemblyPath != null) { if (xamlFileProjectPath == null) - xamlFileProjectPath = "/Designer/Fake.xaml"; + xamlFileProjectPath = "/Fake.xaml"; //Fabricate fake Uri baseUri = new Uri($"avares://{Path.GetFileNameWithoutExtension(assemblyPath)}{xamlFileProjectPath}"); @@ -43,7 +43,7 @@ namespace Avalonia.DesignerSupport { LocalAssembly = localAsm, DesignMode = true, - UseCompiledBindingsByDefault = bool.TryParse(useCompiledBindings, out var parsedValue ) && parsedValue + UseCompiledBindingsByDefault = bool.TryParse(useCompiledBindings, out var parsedValue) && parsedValue }); var style = loaded as IStyle; var resources = loaded as ResourceDictionary; @@ -90,14 +90,14 @@ namespace Avalonia.DesignerSupport }; } else if (loaded is Application) - control = new TextBlock {Text = "Application can't be previewed in design view"}; + control = new TextBlock { Text = "Application can't be previewed in design view" }; else - control = (Control) loaded; + control = (Control)loaded; window = control as Window; if (window == null) { - window = new Window() {Content = (Control)control}; + window = new Window() { Content = (Control)control }; } if (window.PlatformImpl is OffscreenTopLevelImplBase offscreenImpl)