首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MAUI EntryHandler不包含EntryMapper

MAUI EntryHandler不包含EntryMapper
EN

Stack Overflow用户
提问于 2022-03-24 08:46:12
回答 1查看 251关注 0票数 0

下面的代码一直工作到大约预览11毛伊岛。但是使用预览13,我得到了一个编译器错误:'EntryHandler‘不包含'EntryMapper’的定义。

对PickerMapper也显示了类似的错误。

代码已从正式文档中复制出来。

代码语言:javascript
复制
#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);
    }
}

有人看到解决办法了吗?

我一直在到处搜索,但大家的共识似乎是,代码是正确的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-24 08:55:25

我认为所有的EntryMapperPickerMapper,基本上所有的{Control}Mapper都被重命名为Mapper

此外,我看到每当升级到预览14时,都有对NativeView的引用,这些引用将被重命名为PlatformView,因此您也必须相应地重命名它们。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71599360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档