diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-06-16 09:45:09 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-06-16 16:45:09 +0100 |
commit | d5be2f0144ca810fdfbf59808d526c26fe86017e (patch) | |
tree | 3ad7e4465307cd6d633184e05d85eb3a4df59e01 /Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs | |
parent | 04f7bd296ee67af9189ecd7fdfbd2808ca16ce9a (diff) | |
download | xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.gz xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.bz2 xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.zip |
Prep Page for removal of InternalsVisibleTo (#150)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs index a7e37c98..90a24376 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs @@ -20,6 +20,8 @@ namespace Xamarin.Forms.Platform.iOS UIColor _defaultTintColor; UITextField _textField; + IElementController ElementController => Element as IElementController; + protected override void Dispose(bool disposing) { if (disposing) @@ -130,20 +132,18 @@ namespace Xamarin.Forms.Platform.iOS void OnCancelClicked(object sender, EventArgs args) { - ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, null); + ElementController.SetValueFromRenderer(SearchBar.TextProperty, null); Control.ResignFirstResponder(); } void OnEditingEnded(object sender, EventArgs e) { - if (Element != null) - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } void OnEditingStarted(object sender, EventArgs e) { - if (Element != null) - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void OnSearchButtonClicked(object sender, EventArgs e) @@ -154,7 +154,7 @@ namespace Xamarin.Forms.Platform.iOS void OnTextChanged(object sender, UISearchBarTextChangedEventArgs a) { - ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, Control.Text); + ElementController.SetValueFromRenderer(SearchBar.TextProperty, Control.Text); } void UpdateAlignment() |