2017-12-29 110 views
0

나는 아주 간단한 UWP 응용 프로그램을 가지고 있으며 몇 가지 디자인 변경 사항을 가져올 새 업데이트 작업을하고 있습니다. 그리고이 새로운 업데이트에서 "정보"버튼을 갖고 싶습니다. 사용자가 버튼을 클릭하면 앱에 대한 더 많은 정보를 보여주는 "팝업"이 열립니다.다른 페이지의 XAML 팝업/페이지 XAML - UWP App

즉, 내가 원하는 것은 이 단추를 클릭하면 XAML 홈 페이지의 위에 작은 XAML 페이지가 열립니다.

가능합니까? 그렇다면 어떻게?

답변

1

예, 가능합니다. 새보기를 작성하고이 새보기로 전환하려고합니다.

private async void Button_Click(object sender, RoutedEventArgs e) 
{ 
    CoreApplicationView newView = CoreApplication.CreateNewView(); 
    int newViewId = 0; 
    await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => 
    { 
     Frame frame = new Frame(); 
     frame.Navigate(typeof(SecondaryPage), null); 
     Window.Current.Content = frame; 
     // You have to activate the window in order to show it later. 
     Window.Current.Activate(); 

     newViewId = ApplicationView.GetForCurrentView().Id; 
    }); 
    bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); 
} 

또는 Popup 컨트롤을 열면됩니다.

두 가지 방법의 차이점은 팝업 컨트롤이 항상 응용 프로그램 창을 오버레이한다는 점입니다. 새로운보기는 앱 창 경계 밖으로 이동할 수 있습니다.

관련 링크 :

Show multiple views for an app

다음

Popup code example

1

가고,

앱에 대한 정보를 제공하여 About Button Click

 contentDialogAboutUs = new ContentDialog(); 

     Frame framabout = new Frame(); 

     framabout.Navigate(typeof(AboutUs)); 

     contentDialogAboutUs.Content = framabout;   

     await contentDialogAboutUs.ShowAsync(); 

에 간다 코드 폐쇄하는 것이 당신의 AboutUs 페이지에 사용될 수 있도록 AboutUs 페이지

에 당신은 contentDialogAboutUs 정적으로 선언해야합니다.

public static ContentDialog contentDialogAboutUs; 

과 AboutUs 페이지

 HomePage.contentDialogAboutUs.Hide(); 

홈페이지이 AboutUs 클릭 호출 한 곳에서 내 소스 페이지입니다, 사용하여 "팝업"을 닫습니다.

희망이 도움이되었습니다.