首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Carousel视图Xamarin表单给出两个错误

Carousel视图Xamarin表单给出两个错误
EN

Stack Overflow用户
提问于 2017-08-10 03:48:21
回答 2查看 716关注 0票数 0

我从Nuget安装了Xamarin Forms Carousel视图

然而,我得到了两个错误:

1)无法解析程序集:“Xamarin.Forms.CarouselView,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null”“

2) ResolveLibraryProjectImports任务意外失败。System.IO.FileNotFoundException:未能加载程序集'MashamApp,Version=0.0.0.0,Culture=neutral,PublicKeyToken=‘。也许它不存在于Android的Mono配置文件中?

代码语言:javascript
复制
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
         xmlns:control="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView"
         x:Class="MashamApp.MainPage" BackgroundColor="#ff1b74bb">

<Grid x:Name="gMain" BackgroundColor="#ffebf6ff">

    <Grid.RowDefinitions>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
    </Grid.RowDefinitions>

    <Grid Grid.Row="0">
        <Label x:Name="lblName" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontSize="Medium"  TextColor="White"></Label>
    </Grid>

    <Grid Grid.Row="1">
        <control:CarouselView ItemsSource="{Binding MyDataSource}">
            <control:CarouselView.ItemTemplate>
                <DataTemplate>
                    <Label Text="{Binding LabelText}" />
                </DataTemplate>
            </control:CarouselView.ItemTemplate>
        </control:CarouselView>
    </Grid>
EN

回答 2

Stack Overflow用户

发布于 2017-08-10 04:41:40

我不推荐任何代码更改,因为你的代码看起来很好,但是Xamarin.Forms.CarouselView,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null在我看来有点可疑。我建议您确保您的所有引用都正常工作(项目中的引用没有黄色三角形),也许可以尝试使用nu get package manager console命令重新安装所有的包

代码语言:javascript
复制
Update-Package

您还可以将其限制为一个项目。

代码语言:javascript
复制
Update-Package -Project YourProjectName

如果您想要将这些包重新安装到与以前安装的版本相同的版本,那么您可以使用带有更新包命令的-reinstall参数。

代码语言:javascript
复制
Update-Package -reinstall

我从这个答案How do I get NuGet to install/update all the packages in the packages.config?中学到了一些。

希望这能有所帮助!如果没有,让我知道,我会删除答案(我不得不使用答案,因为我不能评论低于50代表)干杯!

票数 0
EN

Stack Overflow用户

发布于 2017-08-12 16:32:17

嗯,看起来他们改变了命名空间的名称和控件的名称,代码应该是这样的:

代码语言:javascript
复制
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
         xmlns:c="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
         x:Class="MashamApp.MainPage" BackgroundColor="#ff1b74bb">

<Grid x:Name="gMain" BackgroundColor="#ffebf6ff">

    <Grid.RowDefinitions>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
        <RowDefinition Height="1*"></RowDefinition>
    </Grid.RowDefinitions>

    <Grid Grid.Row="0">
        <Label x:Name="lblName" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontSize="Medium"  TextColor="White"></Label>
    </Grid>

    <Grid Grid.Row="1">
        <c:CarouselViewControl x:Name="CaruselViewCon" ItemsSource="{Binding MyDataSource}">
            <c:CarouselViewControl.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding LabelText}" TextColor="Black" />
                </DataTemplate>
            </c:CarouselViewControl.ItemTemplate>
        </c:CarouselViewControl>
    </Grid>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45599456

复制
相关文章

相似问题

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