summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs12
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()