Here is a small piece of code that you can use as a Xamarin Forms effect to hook into your entry.
It allows changing the color of the clear icon that is available inside the native entry control of iOS ( when enabled ).
1 2 3 4 5 6 7 8 9 10 11 12 |
if (Control is UITextField textField) { //Enable the clear icon textField.ClearButtonMode = UITextFieldViewMode.WhileEditing; //Get hold of the clear icon inside the text field UIButton clearButton = textField.ValueForKey(new Foundation.NSString("clearButton")) as UIButton; //Set the desired color clearButton.TintColor = UIColor.Red; UIImage clearImage = UIImage.GetSystemImage("xmark.circle.fill"); //Override the regular image with the colored one clearButton.SetImage(clearImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal); } |
With this platform specific code, we can get a hold of the UIButton inside the UITextField and set a color. Than again pasting it into the UIButton.
As always a full example can be found here https://github.com/Depechie/EntryClearIconColor