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); } }
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); }
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); }
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); }
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); }
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); }
void UpdateTintColor() { BrushHelpers.UpdateColor(Element.Color, ref _tintDefaultBrush, () => Control.TintBrush, brush => Control.TintBrush = brush); }