Example #1
0
 private static ColorKeyFrame CreateColorKeyFrmas(KeyFrames<Color> Model)
 {
     ColorKeyFrame frame = null;
     switch (Model.Type)
     {
         case KeyFramesType.Spline: frame = new SplineColorKeyFrame() { KeySpline = Model.Spline }; break;
         case KeyFramesType.Linear: frame = new LinearColorKeyFrame(); break;
         case KeyFramesType.Easing: frame = new EasingColorKeyFrame() { EasingFunction = Model.EasingFunction }; break;
         case KeyFramesType.Discrete: frame = new DiscreteColorKeyFrame(); break;
         default: break;
     }
     frame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(Model.KeyTime));
     frame.Value = Model.Value;
     return frame;
 }
Example #2
0
        private void InitializeFlashOnStoryBoardAnimation()
        {
            ColorAnimationUsingKeyFrames ckf = new ColorAnimationUsingKeyFrames();

            Storyboard.SetTargetProperty(FlashOnAnimation, new PropertyPath("Color"));
            Storyboard.SetTarget(FlashOnAnimation, backgroundBrush);

            EasingColorKeyFrame lck0 = new EasingColorKeyFrame();
            lck0.KeyTime = TimeSpan.FromMilliseconds(0);
            lck0.Value = accentColor;

            EasingColorKeyFrame lck1 = new EasingColorKeyFrame();
            lck1.KeyTime = TimeSpan.FromMilliseconds(600);
            lck1.Value = backgroundColor;

            ckf.KeyFrames.Add(lck0);
            ckf.KeyFrames.Add(lck1);
            FlashOnAnimation.Children.Add(ckf);
        }
        /// <summary>
        /// Called when the control template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
           
            PART_FindTextBox = GetTemplateChild("PART_FindTextBox") as TextBox;
            PART_ReplaceTextBox = GetTemplateChild("PART_ReplaceTextBox") as TextBox;
            PART_FindButton = GetTemplateChild("PART_FindButton") as Button;
            PART_PreviousMatchButton = GetTemplateChild("PART_PreviousMatchButton") as Button;
            PART_ReplaceButton = GetTemplateChild("PART_ReplaceButton") as Button;
            PART_ReplaceAllButton = GetTemplateChild("PART_ReplaceAllButton") as Button;
            PART_NextMatchButton = GetTemplateChild("PART_NextMatchButton") as Button;
            PART_OptionsButton = GetTemplateChild("PART_OptionsButton") as ToggleButton;
            PART_OptionsList = GetTemplateChild("PART_OptionsList") as ListView;
            PART_HistoryList = GetTemplateChild("PART_HistoryList") as ListView;
            PART_OptionsPopup = GetTemplateChild("PART_OptionsPopup") as Popup;

            if(!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))//Blend uses a StandinPopup class so PART_OptionsPopup will be null
                PART_OptionsPopup.CustomPopupPlacementCallback += (Size popupSize, Size targetSize, Point offset) =>
                            new[] { new CustomPopupPlacement() { Point = new Point(targetSize.Width - popupSize.Width, targetSize.Height) } };

            easingColorKeyFrameEnd = GetTemplateChild("PART_EasingColorKeyFrameEnd") as EasingColorKeyFrame;
            if(easingColorKeyFrameEnd!=null) easingColorKeyFrameEnd.Value = NoHitsBorderBrushColor;
            //UpdateStates(false);
            VisualStateManager.GoToState(this, "NoQuery", false);
            VisualStateManager.GoToState(this, "Blur_NoQuery", true);



                    

            base.OnApplyTemplate();
        }