Maui customise Entry elements for android issue

asked 2023-01-03T11:17:45.68+00:00
Haviv Elbsz 481 Reputation points

Hi all
This code work but
1 Why I forced to add the using directive

2 Why its not working when I put it
in content page constructor

My Entry elements background color is lost why so.

From the internet solutions the same
customise code that works for others
not working for me.

Why so

Thank you very much

   // 02012023  
    using Microsoft.Maui.Platform;  
         
    namespace RazKmoShed;  
         
    public partial class App : Application  
    {  
        public App()  
        {  
            InitializeComponent();  
         
            // Remove Entry control underline  
            Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>  
            {  
                h.PlatformView.BackgroundTintList =  
                    Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToPlatform());  
            });  
         
            MainPage = new AppShell();  
        }  
    }  
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
883 questions
{count} votes