DEV Community

Vamsi Reddy
Vamsi Reddy

Posted on

1 1 1 1 1

.NET MAUI BorderLessEntry for all platforms

Image description

First Create a Class with BorderlessEntry and add the below code

public class BorderlessEntry: Entry

{
}

Next in the MauiProgram.cs file add the below line of code

public static MauiApp CreateMauiApp()

    {
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
    Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("Borderless",(handler,view) =&gt;
    {
        if(view is BorderlessEntry)
        {
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode




if ANDROID


           handler.PlatformView.Background=null;
handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent);
Enter fullscreen mode Exit fullscreen mode




elif IOS || MACCATALYST


                handler.PlatformView.BackgroundColor = UIKit.UIColor.Clear;
handler.PlatformView.Layer.BorderWidth= 0;
handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
Enter fullscreen mode Exit fullscreen mode




elif WINDOWS


                 handler.PlatformView.BorderThickness= new Microsoft.UI.Xaml.Thickness(0);
Enter fullscreen mode Exit fullscreen mode




endif


            }
    });
    return builder.Build();
}
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode




final in Solution Explore open Platforms/Windows/App. Xaml and add the below line of code

<maui: MauiWinUIApplication.Resources>
<Thickness x:Key="TextControlBorderThemeThickness">0</Thickness>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0</Thickness>
</maui: MauiWinUIApplication.Resources>

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (1)

Collapse
 
andersonpull profile image
Anderson Oliveira Bezerra

Very good, congratulations on the content.

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more