コード例 #1
0
        /// <summary>
        /// IsTransitioningProperty property changed handler.
        /// </summary>
        /// <param name="d">TransitioningContentControl that changed its IsTransitioning.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnIsTransitioningPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TransitioningContentControl source = (TransitioningContentControl)d;

            if (!source._allowIsTransitioningWrite)
            {
                source.IsTransitioning = (bool)e.OldValue;
                throw new InvalidOperationException(Properties.Resources.TransitiotioningContentControl_IsTransitioningReadOnly);
            }
        }
コード例 #2
0
        /// <summary>
        /// TransitionProperty property changed handler.
        /// </summary>
        /// <param name="d">TransitioningContentControl that changed its Transition.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnTransitionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TransitioningContentControl source = (TransitioningContentControl)d;
            string oldTransition = e.NewValue as string;
            string newTransition = e.NewValue as string;

            if (source.IsTransitioning)
            {
                source.AbortTransition();
            }

            // find new transition
            Storyboard newStoryboard = source.GetStoryboard(newTransition);

            // unable to find the transition.
            if (newStoryboard == null)
            {
                // could be during initialization of xaml that presentationgroups was not yet defined
                if (VisualStates.TryGetVisualStateGroup(source, PresentationGroup) == null)
                {
                    // will delay check
                    source.CurrentTransition = null;
                }
                else
                {
                    // revert to old value
                    source.SetValue(TransitionProperty, oldTransition);

                    throw new ArgumentException(
                              string.Format(CultureInfo.CurrentCulture, Properties.Resources.TransitioningContentControl_TransitionNotFound, newTransition));
                }
            }
            else
            {
                source.CurrentTransition = newStoryboard;
            }
        }
コード例 #3
0
ファイル: FlipView.cs プロジェクト: jinlook/MahApps.Metro
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ShowBannerStoryboard = ((Storyboard)this.Template.Resources["ShowBannerStoryboard"]).Clone();
            HideBannerStoryboard = ((Storyboard)this.Template.Resources["HideBannerStoryboard"]).Clone();

            ShowControlStoryboard = ((Storyboard)this.Template.Resources["ShowControlStoryboard"]).Clone();
            HideControlStoryboard = ((Storyboard)this.Template.Resources["HideControlStoryboard"]).Clone();

            presenter = GetTemplateChild(PART_Presenter) as TransitioningContentControl;
            backButton = GetTemplateChild(PART_BackButton) as Button;
            forwardButton = GetTemplateChild(PART_ForwardButton) as Button;
            upButton = GetTemplateChild(PART_UpButton) as Button;
            downButton = GetTemplateChild(PART_DownButton) as Button;
            bannerGrid = GetTemplateChild(PART_BannerGrid) as Grid;
            bannerLabel = GetTemplateChild(PART_BannerLabel) as Label;

            bannerLabel.Opacity = IsBannerEnabled ? 1.0 : 0.0;
        }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: fuhongliang/oa
        private void initLeftMenu(List<T_SYS_ENTITYMENU> menulist)
        {
            #region 源代码备份
            //StackPanel menuTemp = new StackPanel();
            //menuTemp.Margin = new Thickness(0, 1, 0, 1);
            //leftMenu.MenuRoot.Children.Add(menuTemp);

            //HyperlinkButton btnTest = new HyperlinkButton();
            //btnTest.Height = 22;
            //btnTest.FontSize = 13.333;
            //btnTest.FontWeight = FontWeights.Bold;
            //btnTest.Content = "     动态菜单";
            //btnTest.Style = new Style(typeof(HyperlinkButton));
            //Link3.NavigateUri=null;
            //btnTest.NavigateUri = new Uri("/SMT.SaaS.OA.UI;component/Views/Home.xaml", System.UriKind.Relative); //("//Home.xaml");           
            //btnTest.TargetName = "contenxtPanle";
            //btnTest.Click += new RoutedEventHandler(delegate
            //{
            //    ContentFrame.Navigate(new Uri("/Home", UriKind.Relative));
            //});
            //menuTemp.Children.Add(btnTest);
            //btnTest.Style = new Style();
            #endregion

            if (toolkitacc.Items != null)
                toolkitacc.Items.Clear();

            //生成分组
            var groupItems = from m in menulist
                             where m.T_SYS_ENTITYMENU2Reference.EntityKey == null
                             orderby m.ORDERNUMBER
                             select m;

            foreach (var item in groupItems)
            {
                AccordionItem group = new AccordionItem();
                group.Header = item;

                group.Style = this.Resources["TreeMenuGroupStyle"] as Style;
                group.BorderThickness = new Thickness(0);
                group.FontSize = 14.0;

                if (UIHelper._CurrentStyleCode_2 == 1)
                {
                    group.Foreground = Application.Current.Resources["TextBBlue1"] as SolidColorBrush;
                }

                group.VerticalContentAlignment = VerticalAlignment.Stretch;
                group.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                group.VerticalAlignment = VerticalAlignment.Stretch;
                group.HorizontalAlignment = HorizontalAlignment.Stretch;

                //生成菜单明细
                var menuItems = from m in menulist
                                where m.T_SYS_ENTITYMENU2Reference.EntityKey !=null
                                && m.T_SYS_ENTITYMENU2Reference.EntityKey.EntityKeyValues[0].Value.ToString() == item.ENTITYMENUID
                                orderby m.ORDERNUMBER
                                select m;

                TransitioningContentControl ctrl = new TransitioningContentControl();

                StackPanel pnl = new StackPanel();
                pnl.VerticalAlignment = VerticalAlignment.Stretch;
                pnl.HorizontalAlignment = HorizontalAlignment.Stretch;
                pnl.Margin = new Thickness(0, 0, 0, 0);

                TreeView tree = new TreeView();
                tree.Style = (Style)Application.Current.Resources["TreeViewStyle"];
                tree.BorderThickness = new Thickness(0);
                tree.HorizontalAlignment = HorizontalAlignment.Stretch;
                tree.Width = toolkitacc.ActualWidth;
                tree.Margin = new Thickness(0);

                foreach (var menu in menuItems)
                {
                    TreeViewItem treeItem = CreateTreeItem(menu);
                    AddSubMenu(menulist, treeItem, menu);
                    tree.Items.Add(treeItem);
                }

                ctrl.Content = tree;
                group.Content = ctrl;
                toolkitacc.Items.Add(group);
            }

        }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: nbclark/commuter
        private void TransitioningContentControl_TransitionCompleted(object sender, RoutedEventArgs e)
        {
            //// Set the root visual to use the transitioning control.
            TransitioningContentControl transitionControl = (TransitioningContentControl)sender;
            //transitionControl.Transition = "RightTransition";

            TransitionControl = transitionControl;
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: nbclark/commuter
 void Current_Activated(object sender, Microsoft.Phone.Shell.ActivatedEventArgs e)
 {
     DisplaySplash = false;
     DataContextManager.HandleActivated();
     TransitionControl = new TransitioningContentControl();
 }