How to remove underline from Entry and caret from picker in maui for windows?

Jeff Pfahl 91 Reputation points
2022-06-15T18:03:02.107+00:00

Setting the background for Entry removes the underline in Android but not in Windows. Have not found anyway to remove caret from end of Picker in windows.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,369 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 74,081 Reputation points Microsoft Vendor
    2022-06-16T08:53:52.857+00:00

    Hello,​

    Firstly, Please Ask one question at a time in Q&A forum. Can you share details about Setting the background for Entry removes the underline in Android?

    1. If you want to hide the picker dropdown icon for windows.
    Before you get start to custom picker, please read Customize a control with a mapper document.
    Then You can use PickerHandler to get Microsoft.UI.Xaml.Controls.AnimatedIcon from VisualTreeHelper, then hide it by animatedIcon .Visibility = Microsoft.UI.Xaml.Visibility.Collapsed

    Or you can re-templating controls(recommanded). Please find generic.xaml file in your computer. Open generic.xaml, You can find many style for different controls, Picker is implemented by ComboBox in windows(MAUI controls are implemented by each platform's native controls and using the native UI language), so you need to search information about ComboBox, then I find <x:Double x:Key="ComboBoxArrowThemeFontSize">21</x:Double>, if you want to hide it, you can add following style in the windows folder->App.xaml file.

       <maui:MauiWinUIApplication.Resources>  
               <x:Double x:Key="ComboBoxArrowThemeFontSize">0</x:Double>  
         </maui:MauiWinUIApplication.Resources>  
    

    Or you can find a controls' template (WinUI control sources is in https://github.com/microsoft/microsoft-ui-xaml )

    2. If you want to remove underline from Entry, please use EntryHandler,set handler.PlatformView.BorderThickness = new Microsoft.UI.Xaml.Thickness(0);

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.