示例#1
0
 private static void OnIsMouseOverRootVisualPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is UIElement uiElement)
     {
         if (GetRevealBrushMode(uiElement) == RevealBrushMode.Border)
         {
             RevealBorderBrushHelper.UpdateBrush(uiElement);
         }
     }
 }
示例#2
0
 private static void OnRevealBrushModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is UIElement uiElement && e.NewValue is RevealBrushMode revealBrushMode)
     {
         uiElement.OpacityMask = revealBrushMode switch
         {
             RevealBrushMode.Border => RevealBorderBrushHelper.GetRevealBrush(uiElement),
             RevealBrushMode.Background => RevealBackgroundBrushHelper.GetHoverRevealBrush(uiElement),
             RevealBrushMode.BackgroundPressed => RevealBackgroundBrushHelper.GetPressedRevealBrush(uiElement),
             // Could be set to any color given that its alpha is 100%. I just use YellowGreen because it's my favorite color.
             _ => Brushes.YellowGreen,
         };
     }
 }
示例#3
0
        private static void OnStatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d is UIElement uiElement)
            {
                var revealBrushMode = GetRevealBrushMode(uiElement);
                if (revealBrushMode != RevealBrushMode.None)
                {
                    switch (revealBrushMode)
                    {
                    case RevealBrushMode.Border:
                        RevealBorderBrushHelper.UpdateBrush(uiElement);
                        break;

                    case RevealBrushMode.Background:
                    case RevealBrushMode.BackgroundPressed:
                        RevealBackgroundBrushHelper.UpdateBrush(uiElement);
                        break;

                    default:
                        break;
                    }
                }
            }
        }