-
-
Save dkudelko/f256d10968c7c8b6a63447714d1d5b97 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 hidden or 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