Example #1
0
        private static void OnButtonMouseLeave(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var buttonStyle = GetButtonStyle(button);
            var hoverBrush = GetHoverBrush(button);

            if (hoverBrush == null)
                return;

            var list = new List<DependencyProperty>();
            switch (buttonStyle)
            {
                case ButtonStyle.Standard:
                    list.Add(Button.BackgroundProperty);
                    break;
                case ButtonStyle.Hollow:
                    list.Add(Button.BackgroundProperty);
                    list.Add(Button.ForegroundProperty);
                    list.Add(IconHelper.ForegroundProperty);
                    break;
                case ButtonStyle.Outline:
                    list.Add(Button.BorderBrushProperty);
                    list.Add(Button.ForegroundProperty);
                    list.Add(IconHelper.ForegroundProperty);
                    break;
                case ButtonStyle.Link:
                    list.Add(Button.ForegroundProperty);
                    list.Add(IconHelper.ForegroundProperty);
                    break;
            }
            StoryboardUtils.BeginBrushStoryboard(button, list);
        }
Example #2
0
        private static void OnButtonMouseEnter(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var buttonStyle = GetButtonStyle(button);
            var hoverBrush = GetHoverBrush(button);

            if (hoverBrush == null)
                return;

            var dic = new Dictionary<DependencyProperty, Brush>();
            switch (buttonStyle)
            {
                case ButtonStyle.Standard:
                    dic.Add(Button.BackgroundProperty, hoverBrush);
                    break;
                case ButtonStyle.Hollow:
                    dic.Add(Button.BackgroundProperty, hoverBrush);
                    dic.Add(Button.ForegroundProperty, Brushes.White);
                    dic.Add(IconHelper.ForegroundProperty, Brushes.White);

                    break;
                case ButtonStyle.Outline:
                    dic.Add(Button.BorderBrushProperty, hoverBrush);
                    dic.Add(Button.ForegroundProperty, hoverBrush);
                    dic.Add(IconHelper.ForegroundProperty, hoverBrush);
                    break;
                case ButtonStyle.Link:
                    dic.Add(Button.ForegroundProperty, hoverBrush);
                    dic.Add(IconHelper.ForegroundProperty, hoverBrush);
                    break;
            }
            StoryboardUtils.BeginBrushStoryboard(button, dic);
        }
Example #3
0
        private void Card_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (HoverBorderBrush == null)
            {
                return;
            }
            var list = new List <DependencyProperty>();

            list.Add(BorderBrushProperty);
            StoryboardUtils.BeginBrushStoryboard(this, list);
        }
Example #4
0
        private void Card_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (HoverBorderBrush == null)
            {
                return;
            }
            var dic = new Dictionary <DependencyProperty, Brush>();

            dic.Add(BorderBrushProperty, HoverBorderBrush);
            StoryboardUtils.BeginBrushStoryboard(this, dic);
        }
        private static void OnComboBoxItemMouseLeave(object sender, RoutedEventArgs e)
        {
            var button           = sender as ComboBoxItem;
            var hoverBackground  = GetItemHoverBackground(button);
            var hoverBorderBrush = GetItemHoverBorderBrush(button);
            var hoverForeground  = GetItemHoverForeground(button);

            if (hoverBackground == null && hoverBorderBrush == null && hoverForeground == null)
            {
                return;
            }

            var list = new List <DependencyProperty>();

            list.Add(ComboBoxItem.BackgroundProperty);
            list.Add(ComboBoxItem.ForegroundProperty);
            list.Add(ComboBoxItem.BorderBrushProperty);

            StoryboardUtils.BeginBrushStoryboard(button, list);
        }
        private static void OnComboBoxItemMouseEnter(object sender, RoutedEventArgs e)
        {
            var button           = sender as ComboBoxItem;
            var hoverBackground  = GetItemHoverBackground(button);
            var hoverBorderBrush = GetItemHoverBorderBrush(button);
            var hoverForeground  = GetItemHoverForeground(button);

            if (hoverBackground == null && hoverBorderBrush == null && hoverForeground == null)
            {
                return;
            }

            var dic = new Dictionary <DependencyProperty, Brush>();

            dic.Add(ComboBoxItem.BackgroundProperty, hoverBackground);
            dic.Add(ComboBoxItem.ForegroundProperty, hoverForeground);
            dic.Add(ComboBoxItem.BorderBrushProperty, hoverBorderBrush);

            StoryboardUtils.BeginBrushStoryboard(button, dic);
        }
Example #7
0
        private static void OnTextBoxLostFocus(object sender, RoutedEventArgs e)
        {
            var textBox       = sender as TextBox;
            var fcBorderBrush = GetFocusedBorderBrush(textBox);
            var fcForeground  = GetFocusedForeground(textBox);

            if (fcBorderBrush == null && fcForeground == null)
            {
                return;
            }

            var list = new List <DependencyProperty>();

            if (fcBorderBrush != null)
            {
                list.Add(TextBox.BorderBrushProperty);
            }
            if (fcForeground != null)
            {
                list.Add(TextBox.ForegroundProperty);
            }

            StoryboardUtils.BeginBrushStoryboard(textBox, list);
        }
Example #8
0
        private static void OnTextBoxGotFocus(object sender, RoutedEventArgs e)
        {
            var textBox       = sender as TextBox;
            var fcBorderBrush = GetFocusedBorderBrush(textBox);
            var fcForeground  = GetFocusedForeground(textBox);

            if (fcBorderBrush == null && fcForeground == null)
            {
                return;
            }

            var dic = new Dictionary <DependencyProperty, Brush>();

            if (fcBorderBrush != null)
            {
                dic.Add(TextBox.BorderBrushProperty, fcBorderBrush);
            }
            if (fcForeground != null)
            {
                dic.Add(TextBox.ForegroundProperty, fcForeground);
            }

            StoryboardUtils.BeginBrushStoryboard(textBox, dic);
        }