简体   繁体   中英

How to navigate from a usercontrol to a page

我有一个usercontrol。当我点击这个usercontrol中的一个按钮时,我需要导航到另一个xaml页面。我该怎么办?

use this in your usercontrol.

    <Frame NavigationUIVisibility="Hidden" Name="ContentFrame" />

once the user performs a button click action c# code event function will be triggered. In that function use this to goto the page you like

    Page page = new Page()
    Dispatcher.Invoke(() => { this.ContentFrame.Navigate(page); });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM