Does MAUI offer an entry control with supporting text

Srilekha Chowdary 20 Reputation points
2024-04-03T05:25:50.4+00:00

Hi,

I want to know if MAUI offers an entry control with supporting text(eg: First name) as shown in the material design. I am attaching the screenshot for reference

User's image

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

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 34,841 Reputation points Microsoft Vendor
    2024-04-04T05:50:56.2033333+00:00

    Hello,

    This type of control is not available out-of-the-box at MAUI at this time.

    You can customize a similar layout using AbsoluteLayout and Frame Customization, please refer to the following code:

    <StackLayout x:Name="stacklayout" HorizontalOptions="FillAndExpand">
            <Label Text="test label">
            </Label>
            <AbsoluteLayout HorizontalOptions="FillAndExpand" Padding="20">
                <Label Text="First Name" AbsoluteLayout.LayoutBounds="18,-13" Background="White" FontSize="14" ZIndex="99"/>
                <Frame>
                    <Entry Margin="-10" WidthRequest="300"/>
                </Frame>
            </AbsoluteLayout>
        </StackLayout>
    

    If you also need to remove the underline from the Entry on Android, you can add the following code to the constructor of the page.

    public MainPage()
    
            {
    
                InitializeComponent();
    
                Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>
    
                {
    
                    // Remove underline:
    #if ANDROID
                    h.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
    #endif
                });
    
            }
    

    Best Regards,

    Alec Liu.


    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.


0 additional answers

Sort by: Most helpful