开发者

Is it possible to disable the clicking of links in a WPF Frame control?

I have a WPF Frame control in an application that I use to load a preview of a page that doesn't exist on the server yet.

Because it doesn't exist, and because it's inside my app, I need to figure out a way to ideally disable the hyperlinks so they can't be clicked. Although, forcing it to load in a new window so it's no longer in my app is an acceptable workaround.

Unfortunately, messing with the HTML isn't an option in this instance.

Given it's IE behind the scenes, is this开发者_开发技巧 even possible?


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


Admittedly I don't fully understand what you are trying to do but I have disable users ability to click on controlls in WPF before by setting e.Handled = true; in the correct event.
Try mouse down.

private void ContentControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    e.Handled = true;
}


use a System.Windows.Control.WebBrowser and on "Navigated" event turn to false a global bool variable that is initially set to true (On window "loaded" event).

In System.Windows.Controls.WebBrowser Navigating event check this bool var and set e.cancel to true if you want links to be prevented. Other Controls may be used in order to change the value of this global bool variable to true and enable navigation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜