From dcfc39dcefc933cac0199eed4eb6bcce83948b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Thu, 17 Feb 2022 11:28:28 +0000 Subject: [PATCH] Move --- BlazorDemo.Web/Pages/Dialogs.razor | 9 +++++++++ BlazorDemo.Web/Pages/Index.razor | 16 +--------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/BlazorDemo.Web/Pages/Dialogs.razor b/BlazorDemo.Web/Pages/Dialogs.razor index a063192..7bf011a 100644 --- a/BlazorDemo.Web/Pages/Dialogs.razor +++ b/BlazorDemo.Web/Pages/Dialogs.razor @@ -75,4 +75,13 @@ _saveFileDialogOptions = null; } + + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + Avalonia.AvaloniaLocator.CurrentMutable.Bind().ToConstant(this); + } + base.OnAfterRender(firstRender); + } } diff --git a/BlazorDemo.Web/Pages/Index.razor b/BlazorDemo.Web/Pages/Index.razor index 6a55711..71c38ad 100644 --- a/BlazorDemo.Web/Pages/Index.razor +++ b/BlazorDemo.Web/Pages/Index.razor @@ -1,19 +1,5 @@ @page "/" - + - -@code { - - private Dialogs? _dialogs; - - protected override void OnAfterRender(bool firstRender) - { - if (firstRender && _dialogs is { }) - { - Avalonia.AvaloniaLocator.CurrentMutable.Bind().ToConstant(_dialogs); - } - base.OnAfterRender(firstRender); - } -} \ No newline at end of file