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); } }
protected override void UpdateBackground() { base.UpdateBackground(); if (Control == null) { return; } BrushHelpers.UpdateBrush(Element.Background, 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); }