Пример #1
0
        private void PlayShowingAnimation()
        {
            //Slide animation
            this.PlaySlideInAnim();

            //BG alpha animation
            IEasingFunction powerEasing = new PowerEase()
            {
                EasingMode = EasingMode.EaseOut
            };

            Color     startColor            = "#FFFFFF55".ToColor();
            Color     endColor              = "#FFFFFF00".ToColor();
            const int AlphaDurationMillisec = 400;

            for (int i = 0; i < itemViews.Length; ++i)
            {
                int reverseI = itemViews.Length - 1 - i;

                Duration       alphaDuration = new Duration(new TimeSpan(0, 0, 0, 0, AlphaDurationMillisec));
                ColorAnimation alhpaAnim     = new ColorAnimation()
                {
                    BeginTime      = new TimeSpan(0, 0, 0, 0, reverseI * 30),
                    From           = startColor,
                    To             = endColor,
                    Duration       = alphaDuration,
                    EasingFunction = powerEasing,
                };
                OrderTypeItemView itemView = itemViews[i];
                itemView.Background = new SolidColorBrush(startColor);
                itemView.Background.BeginAnimation(SolidColorBrush.ColorProperty, alhpaAnim);
            }
        }
Пример #2
0
        private void CreateTypeItems()
        {
            string[] orderTypeTexts = Enum.GetNames(typeof(OrderType));
            itemViews = new OrderTypeItemView[orderTypeTexts.Length];

            for (int i = 0; i < orderTypeTexts.Length; ++i)
            {
                string orderTypeText = orderTypeTexts[i];

                OrderTypeItemView typeItemView = itemViews[i] = new OrderTypeItemView();
                typeItemView.TypeNameText = orderTypeText;
                typeItemView.OrderType    = (OrderType)Enum.Parse(typeof(OrderType), orderTypeText);
                typeItemView.Click       += TypeItemView_Click;

                if (i == orderTypeTexts.Length - 1)
                {
                    typeItemView.IsSeparatorVisible = false;
                }

                TypeItemStackPanel.Children.Add(typeItemView);
            }
        }