Social Icons

Tuesday, September 18, 2012

Handling xaml not found error while navigating to non-existing xaml form

In some cases in your silverlight application the link is present for non-existing or old xaml view form. which does not exist in actual or removed after any updation. In this case while nevigating to this form silverlight runtime exception will occur. To handle this exception you need to add NavigationFailed event for the frame.

In Xaml:

<sdk:Frame  Height="175" HorizontalAlignment="Left" Margin="48,92,0,0" Name="frame1" VerticalAlignment="Top" Width="293" BorderBrush="#006C1313" NavigationFailed="frame1_NavigationFailed" />

In Xaml.cs


private void frame1_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
            e.Handled = true;
            this.frame1.Navigate(new Uri("/Testview/ErrorPage.xaml", UriKind.Relative));
}

No comments:

Post a Comment

 

Sample text

Sample Text