下面的代码一直工作到大约预览11毛伊岛。但是使用预览13,我得到了一个编译器错误:'EntryHandler‘不包含'EntryMapper’的定义。
对PickerMapper也显示了类似的错误。
代码已从正式文档中复制出来。
#if ANDROID
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
#endif
using Application = Microsoft.Maui.Controls.Application;
namespace myapp;
public partial class App : Application
{
public App(AuthenticationService authenticationService, SyncService syncService)
{
InitializeComponent();
// Remove underline from all pickers and entries in app
#if ANDROID
Microsoft.Maui.Handlers.PickerHandler.PickerMapper.AppendToMapping("NoUnderline", (h, v) =>
{
h.NativeView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
});
Microsoft.Maui.Handlers.EntryHandler.EntryMapper.AppendToMapping("NoUnderline", (h, v) =>
{
h.NativeView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
});
#endif
MainPage = new AppShell(authenticationService, syncService);
}
}有人看到解决办法了吗?
我一直在到处搜索,但大家的共识似乎是,代码是正确的。
发布于 2022-03-24 08:55:25
我认为所有的EntryMapper和PickerMapper,基本上所有的{Control}Mapper都被重命名为Mapper。
此外,我看到每当升级到预览14时,都有对NativeView的引用,这些引用将被重命名为PlatformView,因此您也必须相应地重命名它们。
https://stackoverflow.com/questions/71599360
复制相似问题