0

我在应用程序中有一个 WPF 框架控件,用于加载服务器上尚不存在的页面的预览。

因为它不存在,而且它在我的应用程序中,所以我需要找到一种方法来理想地禁用超链接,这样它们就不能被点击。虽然,强制它在新窗口中加载以使其不再出现在我的应用程序中是一种可接受的解决方法。

不幸的是,在这种情况下,不能选择弄乱 HTML。

鉴于它是幕后的 IE,这甚至可能吗?

4

3 回答 3

0

You should just be able to hook the Frame::Navigating event and then set the NavigatingCancelEventArgs::Cancel property to true.

于 2009-11-10T03:40:21.053 回答
0

诚然,我不完全理解您要做什么,但我已经禁用用户通过设置e.Handled = true;正确的事件之前单击 WPF 中的控件的能力。
试试鼠标向下。

private void ContentControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    e.Handled = true;
}
于 2009-11-10T03:51:32.210 回答
0

使用 System.Windows.Control.WebBrowser 并在“导航”事件中将全局布尔变量设置为 false,该变量最初设置为 true(在窗口“加载”事件中)。

在 System.Windows.Controls.WebBrowser Navigating 事件中检查此 bool var 并将 e.cancel 设置为 true 如果您希望阻止链接。可以使用其他控件来将此全局布尔变量的值更改为 true 并启用导航。

于 2010-06-24T14:23:22.683 回答