summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs40
1 files changed, 8 insertions, 32 deletions
diff --git a/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs b/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
index 04e1058..9b80ade 100644
--- a/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
@@ -155,23 +155,11 @@ namespace Xamarin.Forms.Platform.UWP
Color placeholderColor = Element.PlaceholderColor;
- if (placeholderColor.IsDefault)
- {
- if (_defaultPlaceholderColorBrush == null)
- return;
-
- _queryTextBox.PlaceholderForegroundBrush = _defaultPlaceholderColorBrush;
- _queryTextBox.PlaceholderForegroundBrush = _defaultPlaceholderColorFocusBrush;
- }
-
- if (_defaultPlaceholderColorBrush == null)
- {
- _defaultPlaceholderColorBrush = _queryTextBox.PlaceholderForegroundBrush;
- _defaultPlaceholderColorFocusBrush = _queryTextBox.PlaceholderForegroundFocusBrush;
- }
+ BrushHelpers.UpdateColor(placeholderColor, ref _defaultPlaceholderColorBrush,
+ () => _queryTextBox.PlaceholderForegroundBrush, brush => _queryTextBox.PlaceholderForegroundBrush = brush);
- _queryTextBox.PlaceholderForegroundBrush = placeholderColor.ToBrush();
- _queryTextBox.PlaceholderForegroundFocusBrush = placeholderColor.ToBrush();
+ BrushHelpers.UpdateColor(placeholderColor, ref _defaultPlaceholderColorFocusBrush,
+ () => _queryTextBox.PlaceholderForegroundFocusBrush, brush => _queryTextBox.PlaceholderForegroundFocusBrush = brush);
}
void UpdateText()
@@ -186,23 +174,11 @@ namespace Xamarin.Forms.Platform.UWP
Color textColor = Element.TextColor;
- if (textColor.IsDefault)
- {
- if (_defaultTextColorBrush == null)
- return;
-
- _queryTextBox.Foreground = _defaultTextColorBrush;
- _queryTextBox.ForegroundFocusBrush = _defaultTextColorFocusBrush;
- }
-
- if (_defaultTextColorBrush == null)
- {
- _defaultTextColorBrush = _queryTextBox.Foreground;
- _defaultTextColorFocusBrush = _queryTextBox.ForegroundFocusBrush;
- }
+ BrushHelpers.UpdateColor(textColor, ref _defaultTextColorBrush,
+ () => _queryTextBox.Foreground, brush => _queryTextBox.Foreground = brush);
- _queryTextBox.Foreground = textColor.ToBrush();
- _queryTextBox.ForegroundFocusBrush = textColor.ToBrush();
+ BrushHelpers.UpdateColor(textColor, ref _defaultTextColorFocusBrush,
+ () => _queryTextBox.ForegroundFocusBrush, brush => _queryTextBox.ForegroundFocusBrush = brush);
}
}
} \ No newline at end of file