コード例 #1
0
        /// <summary>
        /// Overriding to setup state.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            MetroUI.EnsureTheme(this);
#if TRIAL
            InsertTrialMessage();
#endif
        }
コード例 #2
0
ファイル: MetroControl.cs プロジェクト: jiailiuyan/work
        /// <summary>
        /// Overriding to setup state.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            MetroUI.EnsureTheme(this);

            var transitioningSelector = GetTemplateChild("TransitioningSelector") as TransitioningSelector;

            if (transitioningSelector != null)
            {
                transitioningSelector.SelectionChanged += HandleTransitioningSelectorSelectionChanged;
            }

            SetupIdentity();

            SetupDragDropHelper();

            var visualStateGroups   = VisualStateManager.GetVisualStateGroups(this);
            var animationStateGroup = visualStateGroups.OfType <VisualStateGroup>().Where(g => g.Name == "AnimationStates").FirstOrDefault();

            if (animationStateGroup != null)
            {
                var tileLeavingState = animationStateGroup.States.OfType <VisualState>().Where(s => s.Name == "TileViewLeaving").FirstOrDefault();
                if (tileLeavingState != null)
                {
                    foreach (var animation in tileLeavingState.Storyboard.Children)
                    {
                        animation.Bind(Timeline.DurationProperty, this, AnimationDurationProperty);
                    }
                }

                var tileEnteringState = animationStateGroup.States.OfType <VisualState>().Where(s => s.Name == "TileViewEntering").FirstOrDefault();
                if (tileEnteringState != null)
                {
                    foreach (var animation in tileEnteringState.Storyboard.Children)
                    {
                        animation.Bind(Timeline.DurationProperty, this, AnimationDurationProperty);
                    }
                }
            }

            AddHandler(MetroStartPage.RepositionedEvent, new RoutedEventHandler(HandlePageRepositioned));
            SetPageCanvasPositions();

#if TRIAL
            InsertTrialMessage();
#endif
        }
コード例 #3
0
        /// <summary>
        /// Overriding to setup state.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            if (MetroUI.ThemeProperty.IsUnsetValue(this) && Owner != null)
            {
                var focused = FocusManager.GetFocusedElement(Owner);
                if (focused != null)
                {
                    var theme = MetroUI.GetEffectiveTheme((UIElement)focused);
                    MetroUI.SetTheme(this, theme);
                }
                else
                {
                    MetroUI.SetTheme(this, MetroUI.GetTheme(Owner));
                }
            }

            if (ChromeProperty.IsUnsetValue(this) && Chrome == null)
            {
                Chrome = new MetroChrome {
                    ShowSystemMenu = false, HideMinimizeMaximizeButtons = true, FontWeight = FontWeights.Bold
                };
            }
        }
コード例 #4
0
ファイル: MetroAppWindow.cs プロジェクト: jiailiuyan/work
 /// <summary>
 /// Overriding to setup state.
 /// </summary>
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     MetroUI.EnsureTheme(this);
     Dispatcher.BeginInvoke(new Action(SetStatusBarInnerMargin), DispatcherPriority.ContextIdle);
 }