Exemplo n.º 1
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            //Add MainPage
            {
                HyperlinkButton lHyperLinkButton = new HyperlinkButton();
                lHyperLinkButton.Content     = "计划提醒";
                lHyperLinkButton.NavigateUri = new System.Uri("PlanManagerMain", UriKind.Relative);
                lHyperLinkButton.Style       = Application.Current.Resources["LinkStyleMenu"] as Style;
                lHyperLinkButton.TargetName  = "PlanManagerContentFrame";
                PlanManagerMenu.Children.Add(lHyperLinkButton);
                lHyperLinkButton.Click += HyperLinkButton_Click;
            }

            PlanManagerViewModel PlanManagerViewModel = this.DataContext as PlanManagerViewModel;

            foreach (ISubMenu lSubMenu in PlanManagerViewModel.SubMenuList)
            {
                HyperlinkButton lHyperLinkButton = new HyperlinkButton();
                lHyperLinkButton.Content     = lSubMenu.Content;
                lHyperLinkButton.NavigateUri = new System.Uri(lSubMenu.NavigateUri, UriKind.Relative);
                lHyperLinkButton.Style       = Application.Current.Resources["LinkStyleMenu"] as Style;
                lHyperLinkButton.TargetName  = "PlanManagerContentFrame";
                PlanManagerMenu.Children.Add(lHyperLinkButton);
                lHyperLinkButton.Click += HyperLinkButton_Click;
            }
        }
Exemplo n.º 2
0
 private void PlanManagerContentFrame_Navigated(object sender, NavigationEventArgs e)
 {
     foreach (UIElement child in PlanManagerMenu.Children)
     {
         HyperlinkButton hb = child as HyperlinkButton;
         if (hb != null && hb.NavigateUri != null)
         {
             if (PlanManagerContentFrame.UriMapper.MapUri(e.Uri).ToString().Equals(PlanManagerContentFrame.UriMapper.MapUri(hb.NavigateUri).ToString()))
             {
                 VisualStateManager.GoToState(hb, "ActiveLink", true);
                 PlanManagerViewModel planManagerViewModel = this.DataContext as PlanManagerViewModel;
                 planManagerViewModel.CurrentPageName = hb.Content.ToString();
             }
             else
             {
                 VisualStateManager.GoToState(hb, "InactiveLink", true);
             }
         }
     }
 }
Exemplo n.º 3
0
        void HyperLinkButton_Click(object sender, RoutedEventArgs e)
        {
            PlanManagerViewModel planManagerViewModel = this.DataContext as PlanManagerViewModel;

            planManagerViewModel.IsExpand = false;
        }