New to Telerik UI for .NET MAUIStart a free 30-day trial

Changing Entry Cursor Color on Android and iOS

Updated on Dec 3, 2025

Environment

VersionProductAuthor
8.0.0 and aboveTelerik UI for .NET MAUI EntryDobrinka Yordanova

Description

I am trying to change the cursor color of the UI for .NET MAUI Entry control on Android and on iOS to match the color of other input fields in the application. However, the available documentation for customizing the cursor is for versions 5.2.0 to 7.0.0 and is incompatible with the current version. Since version 8.0.0, the control uses RadTextInput internally instead of RadEntry, which requires different logic for cursor customization.

This knowledge base article also answers the following questions:

  • How to update Entry cursor color on mobile?
  • How to handle breaking changes for cursor customization in Entry after version 8.0.0?
  • How to apply native logic to change cursor color in Entry control?

Solution

To modify the cursor color in the Entry control, follow these steps:

  1. Handle the Loaded event of the Entry control to locate the internal RadTextInput control and apply the necessary native logic.
  2. Use the Handler property of RadTextInput to update the cursor color for Android and iOS.
csharp
private void entry_Loaded(object sender, EventArgs e)
{
    var textInput = ChildOfType<RadTextInput>(this.entry);
    if (textInput != null)
    {
        var handler = textInput.Handler;
        if (handler == null)
        {
            textInput.HandlerChanged += this.OnTextInputHandlerChanged;
        }
        else
        {
            this.UpdateNativeElement(handler);
        }
    }
}

private void OnTextInputHandlerChanged(object sender, EventArgs e)
{
    var textInput = (RadTextInput)sender;
    this.UpdateNativeElement(textInput.Handler);
    textInput.HandlerChanged -= this.OnTextInputHandlerChanged;
}

private void UpdateNativeElement(IViewHandler handler)
{
    var nativeEntry = handler.PlatformView as Telerik.Maui.Platform.RadMauiTextInput;
    if (nativeEntry != null)
    {
#if ANDROID
        nativeEntry.TextCursorDrawable?.SetColorFilter(new Android.Graphics.PorterDuffColorFilter(Android.Graphics.Color.Red, Android.Graphics.PorterDuff.Mode.Darken));
#elif __IOS__
        nativeEntry.TintColor = UIKit.UIColor.Red;
#endif
    }
}

internal static T ChildOfType<T>(View visualElement) where T : View
{
    if (visualElement == null)
    {
        return null;
    }

    foreach (var item in VisualTreeElementExtensions.GetVisualTreeDescendants(visualElement))
    {
        if (item is T targetElement)
        {
            return targetElement;
        }
    }

    return null;
}
  1. Add sample Entry definition in XAML:
xaml
<VerticalStackLayout>
    <telerik:RadEntry x:Name="entry"
                             Loaded="entry_Loaded" />
</VerticalStackLayout>

See Also