严重性代码描述项目项目文件行状态已取消错误XLS 0414找不到类型'ViewModels'。请检查是否没有缺少对程序集的引用,以及是否已编译所有引用的程序集。TravelAppSample C:\TravelAppSample-masterTravelAppSampleViewsTravelPage.xaml 8我收到此错误我已经检查了源目录中的文件夹,并且在本地位置找到了该文件。
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TravelAppSample"
x:Class="TravelAppSample.Views.TravelPage">
<ContentPage.BindingContext >
<local:ViewModels.TravelViewModel />
</ContentPage.BindingContext >
<ContentPage.Content>
<StackLayout>
<!-- Principal-->
<StackLayout BackgroundColor="#f8b732" HeightRequest="350">
<!-- Main image-->
<Image Source="PrincipalImage" HorizontalOptions="Center" VerticalOptions="Center" Margin="0,30,0,0"/>
<!-- Place name & travel date-->
<Label Margin="30,0,0,0">
<Label.FormattedText>
<FormattedString>
<Span Text="Cuzco " FontSize="28" FontAttributes="Bold" ForegroundColor="White" />
<Span Text="20 Marzo - 27 Marzo" FontSize="17" ForegroundColor="White" />
</FormattedString>
</Label.FormattedText>
</Label>
<Frame CornerRadius="35" Margin="0,0,0,-20" BackgroundColor="#f8b732" HasShadow="False" HeightRequest="25" VerticalOptions="EndAndExpand"/>
</StackLayout>
<!-- Days-->
<ScrollView VerticalScrollBarVisibility="Never"
VerticalOptions="Start"
HeightRequest="85"
Orientation ="Horizontal">
<StackLayout x:Name="DaysBlock"
Orientation="Horizontal"
HorizontalOptions="FillAndExpand"
Padding="20,15,20,5">
</StackLayout>
</ScrollView>
<!-- Schedule-->
<StackLayout BackgroundColor="#f8f9fb">
<CollectionView ItemsSource="{Binding travelSchedule}"
SelectedItems="{Binding commmantest}"
VerticalOptions="Start">
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" Padding="30,10">
<!-- Time-->
<Label Text="{Binding Time}" FontAttributes="Bold" FontSize="18"/>
<!-- Travel indicator-->
<StackLayout Orientation="Vertical">
<Image Source="{Binding TransportType}" HeightRequest="30"/>
<BoxView VerticalOptions="FillAndExpand" WidthRequest="2" Color="{Binding TransportColor}" HeightRequest="70" Margin="20,0"/>
</StackLayout>
<!-- Place to go-->
<Image Source="{Binding Picture}" HeightRequest="80" WidthRequest="90" VerticalOptions="Start" />
<!-- Place description-->
<StackLayout>
<Label Text="{Binding Name}" FontAttributes="Bold" FontSize="16" />
<Label Text="{Binding Adress1}" FontSize="15" TextColor="Silver"/>
<Label Text="{Binding Adress2}" FontSize="15" TextColor="Silver"/>
</StackLayout>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>[![enter image description here](https://i.stack.imgur.com/LhiUE.png)](https://i.stack.imgur.com/LhiUE.png)
这是错误的图像:
1条答案
按热度按时间ddhy6vgd1#
您可以尝试像这样添加名称空间:
请参考
TravelPage.xaml
,如下所示: