/// <summary>
 /// Determines, whether this navigator or one of its parents can
 /// navigate to the destination specified in <paramref name="destination"/>.
 /// </summary>
 /// <param name="destination">the name of the navigation destination</param>
 /// <returns>true, if this navigator can navigate to the destination.</returns>
 public virtual bool CanNavigateTo(string destination)
 {
     if (_results.Contains(destination))
     {
         return(true);
     }
     return((ParentNavigator != null) ? ParentNavigator.CanNavigateTo(destination) : false);
 }
Beispiel #2
0
        public void NavigateBack()
        {
            if (ParentNavigator == null)
            {
                return;
            }

            IsEnabled = false;
            var nav = ParentNavigator;

            nav.IsEnabled = true;
            nav.SetFocus(ParentNavigator.GetFocus(), false);

            OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationExitEvent, OwnerElement));
            nav.OwnerElement.RaiseEvent(new RoutedEventArgs(BlockNavigatorProperty.NavigationEnterEvent, nav.OwnerElement));
        }
        /// <summary>
        /// Redirects user to a URL mapped to specified result name.
        /// </summary>
        /// <param name="destination">Name of the result.</param>
        /// <param name="sender">the instance that issued this request</param>
        /// <param name="context">The context to use for evaluating the SpEL expression in the Result.</param>
        public virtual void NavigateTo(string destination, object sender, object context)
        {
            IResult result = GetResult(destination);

            if (result == null)
            {
                if (ParentNavigator != null)
                {
                    ParentNavigator.NavigateTo(destination, sender, context);
                    return;
                }
                HandleUnknownDestination(destination, sender, context);
                return;
            }

            // If no context, 'sender' is context
            if (context == null)
            {
                context = sender;
            }
            result.Navigate(context);
        }