summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-08-16 12:10:32 -0600
committerJason Smith <jason.smith@xamarin.com>2016-08-16 11:10:32 -0700
commit30c0dcb949186c21c60c4c9ddf8a581d40a43662 (patch)
tree17a196012b9d4044f78cc0acbe9aa137d10f2b25 /Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs
parent966683a807f68f302e8f121279387109f2a4a73b (diff)
downloadxamarin-forms-30c0dcb949186c21c60c4c9ddf8a581d40a43662.tar.gz
xamarin-forms-30c0dcb949186c21c60c4c9ddf8a581d40a43662.tar.bz2
xamarin-forms-30c0dcb949186c21c60c4c9ddf8a581d40a43662.zip
Fix Entry/SearchBar color issues (#306)
* Fix disappearing Entry text on UWP Anniversary Edition Fix background color reversion bug in UWP Phone Move SearchBar styling on UWP to its own file Make foreground/background color changes on UWP SearchBar/Entry consistent Fix SearchBar color toggle bug on WP8 * Temporarily moving SDK target to previous version * Fix build error on OSX
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 04e1058a..9b80ade1 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