gpt4 book ai didi

c# - Windows Phone 8.1中如何使用HyperlinkBut​​ton显示ContentDialog页面

转载 作者:太空宇宙 更新时间:2023-11-03 23:43:26 25 4
gpt4 key购买 nike

如何使用HyperlinkBut​​ton在Windows Phone 8.1中显示ContentDialog页面。

XAML:

<HyperlinkButton NavigateUri="Login/ForgotPassword.xaml">
<TextBlock>
<Underline>
<Run>Forgot Password?</Run>
</Underline>
</TextBlock>
</HyperlinkButton>

ForgotPassword.xaml 是一个 ContentDialog 页面,位于 View 文件夹中。通过使用此 XAML 代码,我在单击事件时得到以下窗口屏幕:

enter image description here

这不是预期的。我在这里遗漏了什么吗?

最佳答案

HyperlinkButton.NavigateUri由 WebView 使用:

The action of opening the NavigateUri in a default browser is a system action that takes place without requiring any event handling. If your intent is that the HyperlinkButton should load a specified URI within a WebView control that's also part of your app, then don't specify a value for NavigateUri. Handle the Click event instead, and call WebView.Navigate, specifying the URI to load.

如果您想导航到您的应用程序中的页面或显示对话框,请使用 Click event :

private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
// navigation to Page:
this.Frame.Navigate(typeof(ForgotPassword));
// if you need to show a dialog (it must be defined somewhere in your page clas), then make the whole event async
ForgotPassword dialog = new ForgotPassword();
await dialog.ShowAsync();
}

在 XAML 中:

<HyperlinkButton Click="HyperlinkButton_Click">

关于c# - Windows Phone 8.1中如何使用HyperlinkBut​​ton显示ContentDialog页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28296623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com