未验证 提交 ec004691 编写于 作者: J Jérôme Laban 提交者: GitHub

Merge pull request #12075 from unoplatform/dev/jela/hotreload-update

fix(hr): Adjust Page reload for custom frame presenter
......@@ -206,6 +206,19 @@ namespace Uno.UI.RemoteControl.HotReload
{
parentAsContentControl.Content = newView;
}
else if (newView is Page newPage && oldView is Page oldPage)
{
// In the case of Page, swapping the actual page is not supported, so we
// need to swap the content of the page instead. This can happen if the Frame
// is using a native presenter which does not use the `Frame.Content` property.
// Clear any local context, so that the new page can inherit the value coming
// from the parent Frame. It may happen if the old page set it explicitly.
oldPage.ClearValue(Page.DataContextProperty, DependencyPropertyValuePrecedences.Local);
oldPage.Content = newPage;
newPage.Frame = oldPage.Frame;
}
else
{
VisualTreeHelper.SwapViews(oldView, newView);
......
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Markup;
using Uno.Foundation.Logging;
namespace Windows.UI.Xaml
{
......@@ -21,6 +22,13 @@ namespace Windows.UI.Xaml
{
XamlReader.LoadUsingComponent(document, component);
}
else
{
if (typeof(Application).Log().IsEnabled(LogLevel.Debug))
{
typeof(Application).Log().LogDebug($"Skipping component load, could not find registration for {resourceLocator}");
}
}
}
internal static void RegisterComponent(Uri resourceLocator, string xaml)
......
......@@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Uno.Foundation.Logging;
#if __IOS__
using UIKit;
using _View = UIKit.UIView;
......@@ -31,6 +33,13 @@ namespace Windows.UI.Xaml.Media
currentSuperview?.AddSubview(newView, NSWindowOrderingMode.Above, currentSuperview.Subviews[Math.Max(0, currentPosition - 1)]);
#endif
}
else
{
if (typeof(VisualTreeHelper).Log().IsEnabled(LogLevel.Debug))
{
typeof(VisualTreeHelper).Log().LogDebug($"Unable to swap view, could not find old view's position.");
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册