Windows.Current.Content와 보조 창 사이의 관계는 무엇입니까?
실제로 NavigationService.OpenAsync
메서드는 내부적으로 ViewService.OpenAsync
을 호출합니다.
위의 코드에서
public async Task<IViewLifetimeControl> OpenAsync(UIElement content, string title = null,
ViewSizePreference size = ViewSizePreference.UseHalf)
{
this.Log($"Frame: {content}, Title: {title}, Size: {size}");
var currentView = ApplicationView.GetForCurrentView();
title = title ?? currentView.Title;
var newView = CoreApplication.CreateNewView();
var dispatcher = DispatcherEx.Create(newView.Dispatcher);
var newControl = await dispatcher.Dispatch(async() =>
{
var control = ViewLifetimeControl.GetForCurrentView();
var newWindow = Window.Current;
var newAppView = ApplicationView.GetForCurrentView();
newAppView.Title = title;
// TODO: (Jerry)
// control.NavigationService = nav;
newWindow.Content = content;
newWindow.Activate();
await ApplicationViewSwitcher
.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.Default, currentView.Id, size);
return control;
}).ConfigureAwait(false);
return newControl;
}
, 당신이 얻을 수있는 응용 프로그램의 Window
두 번째 창이 활성화되면 (싱글)이 변경되지 않은, Window
의 Content
가 두 번째 페이지로 대체되었습니다. 그리고 이전 창이 활성화되었을 때 Windows.Current.Content
는 주먹 페이지를 되돌릴 것입니다. 그리고 Window.Current.Activated
이벤트로이를 확인할 수 있습니다.
Window.Current.Activated += Current_Activated;
private void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
{
// check the sender
}
감사합니다.이 질문에 대한 답변입니다. –