Esempio 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(Color.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().ToFormsColor();
                BrushHelpers.UpdateColor(bcolor, ref _defaultDeleteButtonBackgroundColorBrush,
                                         () => _cancelButton.BackgroundBrush, brush => _cancelButton.BackgroundBrush = brush);
            }
        }
Esempio n. 2
0
        void UpdateTextColor()
        {
            Color textColor = Element.TextColor;

            BrushHelpers.UpdateColor(textColor, ref _textDefaultBrush,
                                     () => Control.Foreground, brush => Control.Foreground = brush);

            BrushHelpers.UpdateColor(textColor, ref _defaultTextColorFocusBrush,
                                     () => Control.ForegroundFocusBrush, brush => Control.ForegroundFocusBrush = brush);
        }
        void UpdatePlaceholderColor()
        {
            Color placeholderColor = Element.PlaceholderColor;

            BrushHelpers.UpdateColor(placeholderColor, ref _placeholderDefaultBrush,
                                     () => Control.PlaceholderForegroundBrush, brush => Control.PlaceholderForegroundBrush = brush);

            BrushHelpers.UpdateColor(placeholderColor, ref _defaultPlaceholderColorFocusBrush,
                                     () => Control.PlaceholderForegroundFocusBrush, brush => Control.PlaceholderForegroundFocusBrush = brush);
        }
Esempio n. 4
0
        protected override void UpdateBackground()
        {
            base.UpdateBackground();

            if (Control == null)
            {
                return;
            }

            BrushHelpers.UpdateBrush(Element.Background, ref _backgroundColorFocusedDefaultBrush,
                                     () => Control.BackgroundFocusBrush, brush => Control.BackgroundFocusBrush = brush);
        }
Esempio n. 5
0
        protected override void UpdateBackgroundColor()
        {
            base.UpdateBackgroundColor();

            if (Control == null)
            {
                return;
            }

            // By default some platforms have alternate default background colors when focused
            BrushHelpers.UpdateColor(Element.BackgroundColor, ref _backgroundColorFocusedDefaultBrush,
                                     () => Control.BackgroundFocusBrush, brush => Control.BackgroundFocusBrush = brush);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
 void UpdateTintColor()
 {
     BrushHelpers.UpdateColor(Element.Color, ref _tintDefaultBrush,
                              () => Control.TintBrush, brush => Control.TintBrush = brush);
 }