我正在试着在毛伊岛定制一个条目.主要目的是禁用边框和下划线.这是我在MauiProgram.cs文件中的当前代码:

Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping(nameof(MdeEntry), (handler, view) =>
        {
#if ANDROID
            handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent);
#elif WINDOWS
            //handler.PlatformView.Background = Colors.Transparent.ToPlatform();
            //handler.PlatformView.BorderThickness = new Microsoft.UI.Xaml.Thickness(0);
            //handler.PlatformView.GotFocus += (s, e) =>
            //{
            //    handler.PlatformView.Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.Transparent);
            //    handler.PlatformView.BorderThickness = new Microsoft.UI.Xaml.Thickness(0);
            //    handler.PlatformView.BorderBrush = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.Red);
            //};
#endif
        });

如你所见, comments 代码-是我试图解决我的问题,所有这些代码在Windows上都不起作用.但是,这款安卓系统的应用程序运行情况和我想的一样:

#if ANDROID
            handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent);

有人知道如何在Windows上禁用边框和下划线吗?

推荐答案

try 将其添加到包平台/Windows中的App.XAML上

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

Csharp相关问答推荐

如何使用Microsoft Curve API从搜索的文件中获取内容(文本)?

[0-n]范围内有多少个Integer在其小数表示中至少包含一个9?

将C#字符串转换为其UTF8编码字符的十六进制表示

使用LayoutKind在C#中嵌套 struct .显式

如何模拟耐久任务客户端在统一测试和获取错误在调度NewsListationInstanceAsync模拟设置

Nuget包Serilog.Sinks.AwsCloudwatch引发TypeLoadExceptions,因为父类型是密封的

JsonSerializer.Deserialize<;TValue>;(String,JsonSerializerOptions)何时返回空?

当用户右键单击文本框并单击粘贴时触发什么事件?

try 在.Net核心身份注册页面中使用AJAX,但没有成功..NET Core 5.0 Razor页面应用程序

DbContext-传递自定义配置选项

在.NET 8最低API中从表单绑定中排除属性

将内置的OrderedEumable&Quot;类设置为内部类有什么好处?

异步任务调用程序集

未在Windows上运行的Maui项目

这是否比决定是否使用ConfigureAWait(False)更好?

如何使用ODP.NET C#设置Oracle会话时间长度限制

如何在C#.NET桌面应用程序中动态更改焦点工具上的后退 colored颜色

ASP.NET核心中的授权,如何在DbContext启动之前提供租用ID

外部应用&&的LINQ;左外部连接&类似于PostgreSQL的查询

使用Try-Catch-Finally为API端点处理代码--有什么缺点?