From 46ef861623db0fb064fa2d45779d63b347d1a113 Mon Sep 17 00:00:00 2001 From: James Clancey Date: Mon, 12 Jul 2021 15:43:34 -0800 Subject: [PATCH] Fixed crash in WindowHandler --- src/Comet/Maui/CometWindow.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Comet/Maui/CometWindow.cs b/src/Comet/Maui/CometWindow.cs index f8f32e5e..d45920c1 100644 --- a/src/Comet/Maui/CometWindow.cs +++ b/src/Comet/Maui/CometWindow.cs @@ -27,5 +27,32 @@ namespace Comet public string Title => this.Content.GetTitle(); + + IWindowHandler windowHandler; + + bool SetViewHandler(IWindowHandler handler) + { + if (windowHandler == handler) + return false; + InvalidateMeasurement(); + var oldViewHandler = windowHandler; + //viewHandler?.Remove(this); + windowHandler = handler; + if (windowHandler?.VirtualView != this) + windowHandler?.SetVirtualView(this); + if (ReplacedView != null) + ((IElement)ReplacedView).Handler = handler; + //AddAllAnimationsToManager(); + return true; + + } + + + + IElementHandler IElement.Handler + { + get => this.ViewHandler; + set => SetViewHandler((IWindowHandler)value); + } } }