带有图像的MAUI自定义输入控件

问题描述 投票:0回答:1

我是毛伊岛新手,有基本知识。我想将图像或图标添加到左侧的 MAUI Entry 控件中,而不是使用任何图像控件。

在发布此消息之前,我在互联网上进行了研究。我发现了一些旧的 Xamarin 示例,它们似乎已经过时了。

我对所有这些信息有点困惑,如果有人可以向我提供 MAUI 处理程序的示例,我将不胜感激。

maui
1个回答
0
投票

我使用我的控件来实现这一点,使这一切变得尽可能简单,

添加 nuget:https://www.nuget.org/packages/FreakyControls

Github 在这里:https://github.com/FreakyAli/Maui.FreakyControls

文档位于 wiki 中:https://github.com/FreakyAli/Maui.FreakyControls/wiki

<freakyControls:FreakyEntry
           Placeholder="This is a freaky entry with an image"
           ImagePadding="10" 
           ImageCommand="{Binding ImageWasTappedCommand}"
           ImageCommandParameter="{Binding CommandParam}"
           ImageHeight="{OnPlatform 25, iOS=25, Android=40}"
           ImageWidth="{OnPlatform 25, iOS=25, Android=40}"
           ImageAlignment="Left"
           ImageSource="calendar"/>

如有任何疑问欢迎询问

© www.soinside.com 2019 - 2024. All rights reserved.