Exemplo n.º 1
0
        void UpdateCancelButtonColor()
        {
            if (_cancelButton == null || !_cancelButton.IsReady)
            {
                return;
            }

            Color cancelColor = Element.CancelButtonColor;

            BrushHelpers.UpdateColor(cancelColor, ref _defaultDeleteButtonForegroundColorBrush,
                                     () => _cancelButton.ForegroundBrush, brush => _cancelButton.ForegroundBrush = brush);

            if (cancelColor.IsDefault())
            {
                BrushHelpers.UpdateColor(KnownColor.Default, ref _defaultDeleteButtonBackgroundColorBrush,
                                         () => _cancelButton.BackgroundBrush, brush => _cancelButton.BackgroundBrush = brush);
            }
            else
            {
                // Determine whether the background should be black or white (in order to make the foreground color visible)
                var bcolor = cancelColor.ToWindowsColor().GetContrastingColor().ToColor();
                BrushHelpers.UpdateColor(bcolor, ref _defaultDeleteButtonBackgroundColorBrush,
                                         () => _cancelButton.BackgroundBrush, brush => _cancelButton.BackgroundBrush = brush);
            }
        }
Exemplo n.º 2
0
        protected override void UpdateBackground()
        {
            base.UpdateBackground();

            if (Control == null)
            {
                return;
            }

            BrushHelpers.UpdateBrush(Element.Background, ref _backgroundColorFocusedDefaultBrush,
                                     () => Control.BackgroundFocusBrush, brush => Control.BackgroundFocusBrush = brush);
        }
Exemplo n.º 3
0
        void UpdateTextColor()
        {
            if (_queryTextBox == null)
            {
                return;
            }

            Color textColor = Element.TextColor;

            BrushHelpers.UpdateColor(textColor, ref _defaultTextColorBrush,
                                     () => _queryTextBox.Foreground, brush => _queryTextBox.Foreground = brush);

            BrushHelpers.UpdateColor(textColor, ref _defaultTextColorFocusBrush,
                                     () => _queryTextBox.ForegroundFocusBrush, brush => _queryTextBox.ForegroundFocusBrush = brush);
        }
Exemplo n.º 4
0
        void UpdatePlaceholderColor()
        {
            if (_queryTextBox == null)
            {
                return;
            }

            Color placeholderColor = Element.PlaceholderColor;

            BrushHelpers.UpdateColor(placeholderColor, ref _defaultPlaceholderColorBrush,
                                     () => _queryTextBox.PlaceholderForegroundBrush, brush => _queryTextBox.PlaceholderForegroundBrush = brush);

            BrushHelpers.UpdateColor(placeholderColor, ref _defaultPlaceholderColorFocusBrush,
                                     () => _queryTextBox.PlaceholderForegroundFocusBrush, brush => _queryTextBox.PlaceholderForegroundFocusBrush = brush);
        }
Exemplo n.º 5
0
        void UpdateThumbColor()
        {
            if (Element == null)
            {
                return;
            }

            var thumb = Control?.Thumb;

            if (thumb == null)
            {
                return;
            }

            BrushHelpers.UpdateColor(Element.ThumbColor, ref _defaultThumbColor,
                                     () => thumb.Background, brush => thumb.Background = brush);
        }
Exemplo n.º 6
0
 void UpdateTintColor()
 {
     BrushHelpers.UpdateColor(Element.Color, ref _tintDefaultBrush,
                              () => Control.TintBrush, brush => Control.TintBrush = brush);
 }