views:

66

answers:

1

Hi All,

I am trying to create a back button. So i am binding the navigationwindows backstack.

Code:

 <Hyperlink Name="back" NavigateUri="{Binding RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}, Path=BackStack}">

Problem:

  1. Error: Mode must be specified for RelativeSource.

Update:

It is not navigation to the previous page.

Geetha.

+1  A: 

Add Mode=FindAncestor to the RelativeSource Binding :)

{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type NavigationWindow}}, Path=BackStack}
Arcturus
Hi, Thank you for the reply. Error has gone but it is not working. Do you have any idea on this?
Geetha
BackStack is a list, and NavigateUri expects a Uri :) I don't think Hyperlink will be the answer you are seeking.. Check out Buttons and events. Also, check out this link: http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationservice.getnavigationservice.aspx
Arcturus