void ExecuteNav(NavigationButtonInfo commandInfo)
        {
            if (commandInfo == null)
            {
                throw new NullReferenceException("CommandParameter is not set");
            }

            if (ShellSplitView.DisplayMode == SplitViewDisplayMode.Overlay ||
                ShellSplitView.DisplayMode == SplitViewDisplayMode.CompactOverlay)
            {
                ShellSplitView.IsPaneOpen = false;
            }

            try
            {
                // navigate only to new pages
                if (commandInfo.PageType != null && NavigationService.CurrentPageType != commandInfo.PageType)
                {
                    NavigationService.Navigate(commandInfo.PageType, commandInfo.PageParameter);
                }
            }
            finally
            {
                if (commandInfo.ClearHistory)
                {
                    NavigationService.ClearHistory();
                }
            }
        }
예제 #2
0
        static void ContentChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NavigationButtonInfo navButton = (NavigationButtonInfo)d;
            UIElement            oldValue  = e.OldValue as UIElement;
            UIElement            newValue  = e.NewValue as UIElement;

            if (oldValue != null)
            {
                BindingOperations.SetBinding(oldValue, UIElement.VisibilityProperty, null);
            }
            if (newValue != null)
            {
                BindingOperations.SetBinding(newValue, UIElement.VisibilityProperty, new Binding()
                {
                    Source = navButton, Path = new PropertyPath("Visibility")
                });
            }

            Control oldControl = e.OldValue as Control;
            Control newControl = e.NewValue as Control;

            if (oldControl != null)
            {
                BindingOperations.SetBinding(oldControl, Control.IsEnabledProperty, null);
            }
            if (newControl != null)
            {
                BindingOperations.SetBinding(newControl, Control.IsEnabledProperty, new Binding()
                {
                    Source = navButton, Path = new PropertyPath("IsEnabled")
                });
            }
        }
예제 #3
0
 void ExecuteNav(NavigationButtonInfo commandInfo)
 {
     if (commandInfo == null)
     {
         throw new NullReferenceException("CommandParameter is not set");
     }
     try
     {
         Selected = commandInfo;
     }
     finally
     {
         if (commandInfo.ClearHistory)
         {
             NavigationService.ClearHistory();
         }
     }
 }
예제 #4
0
 void ExecuteNav(NavigationButtonInfo commandInfo)
 {
     if (commandInfo == null)
     {
         throw new NullReferenceException("CommandParameter is not set");
     }
     try
     {
         // navigate only to new pages
         if (commandInfo.PageType != null && NavigationService.CurrentPageType != commandInfo.PageType)
         {
             NavigationService.Navigate(commandInfo.PageType, commandInfo.PageParameter);
         }
     }
     finally
     {
         if (commandInfo.ClearHistory)
         {
             NavigationService.ClearHistory();
         }
     }
 }