-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entry tint color not works in iOS and MAC #13416
Comments
Can you share any workaround or solution to resolve this issue? |
It seems that Change your code to be like this, and it works: #if MACCATALYST || IOS
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("TintColor", (handler, entry) =>
{
handler.PlatformView.TintColor = UIKit.UIColor.Green;
});
#endif Additionally, if you don't want to make the |
Hi @jfversluis As per your suggestion, I have set like below code snippet it works in iOS but it does not work in mac |
Can you open this issue and provide solution or workaround? |
Seems like Apple just didn't implement this functionality for Mac Catalyst. You can do this: #if MACCATALYST || IOS
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("TintColor", (handler, entry) =>
{
#if IOS
handler.PlatformView.TintColor = UIKit.UIColor.Green;
#elif MACCATALYST
var textInputTraits = handler.PlatformView.ValueForKey((NSString)"textInputTraits");
textInputTraits.SetValueForKey(UIColor.Red, (NSString)"insertionPointColor");
#endif
});
#endif But that will only color the cursor. I haven't found a way to also color the selection color, maybe it's just not possible. This is not a bug with .NET MAUI, this is just something that is not working/unclear how to do it in the Apple APIs. |
Description
Changed tint color in entry as like below code snippet by using handler in iOS and mac to change the text selection highlight color.But it does not work in mac and iOS platform.
private void Button_Clicked(object sender, EventArgs e)
{
#if MACCATALYST || IOS
if (entry.Handler.PlatformView is Microsoft.Maui.Platform.MauiTextField macEntry)
{
macEntry.TintColor = UIKit.UIColor.Green;
}
#endif
Steps to Reproduce
1.Run the sample from below link
https://github.com/jeya-kasipandi/Entry-selection-issue
2.Click button to change the entry selection color
3.Type the text and select the text
4.Selection color not changed to green color it show the default color in mac and iOS
Link to public reproduction project repository
https://github.com/jeya-kasipandi/Entry-selection-issue
Version with bug
6.0.312
Last version that worked well
Unknown/Other
Affected platforms
iOS, macOS
Affected platform versions
iOS 16.2,MAC
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: