question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Entry and Editor: option to disable borders and underline (focus)

See original GitHub issue

Description

Would be very usefull a property called HideBorder of boolean type. The same for the underline that appears bellow the control when it has the focus.

Public API Changes

<Entry HideBorder="true" HideUnderLine="true" />

Intended Use-Case

This change is useful when you need to design a cleaner UI.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:29
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
Symbaicommented, Jun 9, 2022

Instead of these two boolean properties I would prefer BorderThickness (set to 0 to hide the borders) and UnderlineColor + UnderlineFocusedColor (set to transparent to hide it). This supports much more scenarios and aligns better with other control properties.

6reactions
balintn22commented, Dec 30, 2022

This is really easy to do using handlers:

In CreateMauiApp add this:

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

Then just subclass Entry control and add the NoUnderline property and in XAML set it to True.

Tried, works, thank you! Instead of placing it in MauiProgram/CreateMauiApp() I placed it in Platforms/Android/MainApplication/CreateMauiApp: `namespace MyNamespace { [Application] public class MainApplication : MauiApplication { public MainApplication(IntPtr handle, JniHandleOwnership ownership) : base(handle, ownership) { }

    protected override MauiApp CreateMauiApp()
    {
        // Remove Entry control underline
        Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>
        {
            h.PlatformView.BackgroundTintList =
                Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
        });

        return MauiProgram.CreateMauiApp();
    }
}

}` It is for Android only, would be nice to see the magic line for iOS as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove underline when Entry receives focus in ...
When an Entry receives focus it displays a border and underline. I am handling focus ... Setting UseSystemFocusVisuals to false does not fix...
Read more >
How to get rid of the border of a Winui 3 TextBox?
You can follow it up here: Entry and Editor: option to disable borders and underline (focus). Thanks for your support and feedback.
Read more >
How to disable borders and underlininng of Entry on ...
The main aim is to disable borders and underlining. This is my current code in MauiProgram.cs file: Microsoft.Maui.Handlers.EntryHandler.Mapper.
Read more >
How to Remove and Style the Border Around Text Input ...
Remove the outline and add a border style using the :focus and :active pseudo-classes with the <input> field. Also, you can remove the...
Read more >
Borderless, Outline, Underline Custom Entry using .NET MAUI ...
Borderless, Outline, Underline Custom Entry using .NET MAUI Handler / Xamarin. This video is regarding How to create Borderless, Outline, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found