Managing Navigation Exceptions
Hello,
In my wpf app I have a frame [MyFrame]. I dynamically change the content of the frame by navigating to different pages [MyFrame.Navigate(somePageURI);].
I want to make sure that I can handle situations where navigation fails. For example, the uri points into noWhere, or the user doesn't have permissions to read the content pointed to by somePageURI.
If I'm not mistake the Navigate method is asynchronous. So I can't do the following:
try {MyFrame.Navigate(somePageURI)} Catch(IOException ioe) {HandleNavigationException(ioe);}
I tried to register a handler with my frame to handle navigation events, but I don't seem to find an event one for navigation error.
Thanks in advance.
Houman
[748 byte] By [
Houmanb] at [2007-12-24]
Hi Lee,
Thanks for the response...but, I can't fine a nviagtionFailed on the Frame, Window or NavigationServices...
My Window is derived from System.Windows.Window.
It is not a NavigationWindow.
Thanks
Houman
I'm having the same problem.
For the time being I'm using "Application.Current.DispatcherUnhandledException" as a workaround.
Best regards,
Thomas Andersen
Hi Houman,
The RC1 download for the .NET Framework 3.0 should have the NavigationFailed event on the Application, Frame, NavigationWindow classes. Which version do you have installed? If you don't already have it, you might want to upgrade to RC1 so you can register a NavigationFailed event handler on your app so it will be able to gracefully handle the cases where errors occur after you've called the Navigate method.
Please note that the NavigationFailed event gets fired for WebExceptions and IOExceptions only, so you may still need to use the Application class's DispatcherUnhandledException event and write your own eventhandler if there are other types of exceptions that you want your application to handle (without crashing the app).
Thanks,
Karen
Hello Karen,
That's great news! Exactly what I want.
I'm still using the June CTP. I haven't switched over because I'm worried that I might loose a day or two of development :(
Is Ocra available for the RC1?
Thanks
Houman