Silverlight的HyperlinkBut​​ton不工作

Silverlight的HyperlinkBut​​ton不工作

问题描述:

我想实现根据Siverlight HyperlinkBut​​ton 本文档:

I'm trying to implement the Siverlight HyperlinkButton according to this documentation:

<HyperlinkButton Content="Click here to learn about Silverlight"
                 NavigateUri="http://www.silverlight.net" 
                 TargetName="_blank" 
                 Margin="10,60,0,0"/>

但是,当我建立并点击它,它显示什么。

But, when I build and click it, it shows nothing.

我的猜测是,你还没有启用外部导航功能的Silverlight对象。如果你还没有一个安全异常将会得到当你点击链接抛出,但你可能不知道被抓住了。这是在你上面的链接的备注栏说明。

My guess would be that you have not enabled external navigation for the Silverlight object. If you haven't a security exception will be getting thrown when you click the link, but you may be catching it without knowing. This is described in the remarks section of your above link.

要启用导航编辑您的Silveright主页(例如,index.html)和Silverlight的对象下添加下面的参数

To enable navigation edit your Silveright host page (E.G. index.html) and add the following param under the Silverlight object

<param name="enableNavigation" value="true" />

在默认情况下的Silverlight生成的.html页面每次运行/调试,所以你将失去的时间参数。为了解决这个问题做出.html文件的副本,在同一目录中,但使用不同的名称或手动指定.html文件在项目设置中使用。

By default Silverlight generates the .html page each time you run/debug so you will lose the param. To get around this make a copy of the .html file in the same directory but with a different name or manually specify which .html file to use in the project settings.

http://msdn.microsoft.com /en-us/library/dd833071(v=vs.95).aspx

更新:

本作品为Chrome,Firefox和IE8。它不为IE9工作。您可以通过使用开发者工具在IE浏览器进行测试。链接与文档模式IE8的工作,但使用文档模式IE9时抛出一个未经授权的访问异常。

This works for Chrome, Firefox and IE8. It does not work for IE9. You can test this in IE by using the developer tools. Links work with Document Mode IE8 but throw an Unauthorized Access exception when using Document Mode IE9.

更新#2:

要让它在IE9工作,你可以强制使用IE8文档模式。要做到这一点,你需要删除的DOCTYPE标记并添加元标记。例如。

To get it to work in IE9 you can force it to use the IE8 Document Mode. To do this you need to remove the DOCTYPE tag and add a meta tag. E.G.

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <meta http-equiv="x-ua-compatible" content="IE=8">
    .
    .

而不是

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    .
    .