如何获得一个简单的超链接以在 XAML 中工作?

Edw*_*uay 3 c# xaml hyperlink

当我运行它并点击链接时,我希望浏览器打开并转到谷歌,但没有任何反应

<Window x:Class="TestHyperlink2343.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <TextBlock>
            You and read this or 
            <Hyperlink NavigateUri="http://www.google.com">go to google</Hyperlink>
             etc.
        </TextBlock>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

然后我用以下代码替换了上面的代码,但仍然没有任何反应。然而,令人惊讶的是,如果我右键单击链接,它会转到谷歌:

<Window x:Class="TestHyperlink2343.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <TextBlock>
            You and read this or 
            <Hyperlink MouseDown="Hyperlink_MouseDown">go to google</Hyperlink>
             etc.
        </TextBlock>
    </Grid>
</Window>

private void Hyperlink_MouseDown(object sender, MouseButtonEventArgs e)
{
    System.Diagnostics.Process.Start("http://www.google.com");
}
Run Code Online (Sandbox Code Playgroud)

为什么这些示例没有按预期工作,我怎样才能让一个简单的超链接工作,因为用户已经习惯了它们在 Web 浏览器中工作(左键单击、打开浏览器、转到站点)?

附录

我通过创建自己的超链接来解决这个问题,没有像这样的超链接元素:

<TextBlock Text="More info at wikipedia" 
  TextDecorations="Underline" 
  MouseDown="TextBlock_MouseDown_Wikipedia"/>

private void TextBlock_MouseDown_Wikipedia(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    System.Diagnostics.Process.Start("http://www.wikipedia.com");
}
Run Code Online (Sandbox Code Playgroud)

奇怪的是,超链接不能这么容易地工作。

Chr*_*isF 5

MSDN指出:

超级链接导航只能发生,但是,如果任一一个的直接或间接的父超链接是导航主机,包括NavigationWindow,或可承载的XBAP任何浏览器(它包括的Internet Explorer 7,微软的Internet Explorer 6和Firefox 2.0 +)。有关详细信息,请参阅导航概述中导航主机主题。

没有看到您的更多代码,我不知道这是否适用于您的情况。