You are trying too hard. Frame navigation is very simple - just create your frame, such as 'MyFrame' then created Hyperlinks with a simple NavigateUri value of "/Acceuil.xaml". If you want to show/hide the links from the status / details of your view model, use a property which you bind to and update in the view model. For example. You can use a UserInfo property, then a converter class such as this to show / hide based upon the UserInfo property being a null value or a class result:
public class HideWhenNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
{
return Visibility.Collapsed;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Hope this helps you get started. Another tip is to add some logic to your application to prevent attempts to navigate to unauthenticated locations. For example:
private void mainFrame_Navigating(object sender, System.Windows.Navigation.NavigatingCancelEventArgs e)
{
List<string> anonUrls = new List<string>();
anonUrls.Add("/Welcome");
anonUrls.Add("/Register");
anonUrls.Add("/ValidateEmail");
var myAnonUrl = (from u in anonUrls
where e.Uri.OriginalString.StartsWith(u)
select u).Count();
if ((WebContext.Current.User == null ||
WebContext.Current.User.IsAuthenticated == false) &&
myAnonUrl == 0)
{
origUri = e.Uri;
e.Cancel = true;
mainFrame.Navigate(new Uri("/Welcome", UriKind.Relative));
}
}
Hoepfully this helps you to understand the navigation frame a little more.