首页 > 解决方案 > 在 xmlns Xamarin 表单中找不到类型 ImageButton

问题描述

参考这个文档

ImageButton 显示图像并响应指示应用程序执行特定任务的点击或单击。

错误:在此代码中的 xmlns 中找不到类型 ImageButton:

<Grid>
        <ImageButton Source="XamarinLogo.png"
            HorizontalOptions="Center"
            VerticalOptions="CenterAndExpand" />
        <Image Source="word.png" Aspect="Fill"/>
    <Label HorizontalOptions="Fill" VerticalOptions="Fill" FontSize="20" TextColor="{Binding TextColor}"
    XAlign="Center" YAlign="Center" Text="{Binding Word}" BackgroundColor="{Binding BoxColor}"/>
</Grid>

标签: xamarin.formsimagebutton

解决方案


从评论中推断,您使用的是旧版本的 Xamarin.Forms。您应该将您的包至少升级到版本 3.4,这是引入ImageButton控件的版本。

在这种情况下,棱镜版本并不重要。


推荐阅读