Created
February 25, 2015 01:44
-
-
Save xleon/9f94a8482162460ceaf9 to your computer and use it in GitHub Desktop.
Xamarin.Forms renderer to hide the "Cancel" button of a SearchBar on iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms.Platform.iOS; | |
using Xamarin.Forms; | |
using UIKit; | |
using System.Diagnostics; | |
[assembly: ExportRenderer(typeof(SearchBar), typeof(Namespace.iOS.Renderers.ExtendedSearchBarRenderer))] | |
namespace Namespace.iOS.Renderers | |
{ | |
public class ExtendedSearchBarRenderer : SearchBarRenderer | |
{ | |
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | |
{ | |
base.OnElementPropertyChanged(sender, e); | |
if (e.PropertyName == "Text") | |
{ | |
Control.ShowsCancelButton = false; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment