如何在ListView XAML中添加多个框架
我想添加几个帧,如下图所示: 问题是这些都在一个标签中,它不允许我在标签中添加多个标签 当我添加第二个时,会出现以下错误: 属性“视图”设置了多次 我附上了我的LIstView的结构截图,以获得更详细的信息及其相应的代码如何在ListView XAML中添加多个框架,xaml,listview,xamarin,xamarin.forms,frame,Xaml,Listview,Xamarin,Xamarin.forms,Frame,我想添加几个帧,如下图所示: 问题是这些都在一个标签中,它不允许我在标签中添加多个标签 当我添加第二个时,会出现以下错误: 属性“视图”设置了多次 我附上了我的LIstView的结构截图,以获得更详细的信息及其相应的代码 <ListView ItemsSource="{Binding Reportes}" SelectionMode="None" Margin="0,0,10,0"
<ListView
ItemsSource="{Binding Reportes}"
SelectionMode="None"
Margin="0,0,10,0"
HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame
CornerRadius="15"
HasShadow="True"
Padding="5"
BackgroundColor="{StaticResource das.color.estado_primary}">
<StackLayout
Orientation="Horizontal"
BackgroundColor="{StaticResource das.color.estado_primary}">
<Image
Source="barrascf"
HeightRequest="80"
WidthRequest="80"
Opacity="1">
</Image>
<StackLayout
Orientation="Vertical"
HorizontalOptions="EndAndExpand"
BackgroundColor="{StaticResource das.color.estado_primary}">
<Label
Text="{Binding ArticulosTotales}"
TextColor="White">
</Label>
<Label
Text="ARTICULOS TOTALES"
TextColor="White">
</Label>
</StackLayout>
</StackLayout>
</Frame>
<Frame
CornerRadius="15"
HasShadow="True"
Padding="5"
BackgroundColor="{StaticResource das.color.estado_primary}">
<StackLayout
Orientation="Horizontal"
BackgroundColor="{StaticResource das.color.estado_primary}">
<Image
Source="barrascf"
HeightRequest="80"
WidthRequest="80"
Opacity="1">
</Image>
<StackLayout
Orientation="Vertical"
HorizontalOptions="EndAndExpand"
BackgroundColor="{StaticResource das.color.estado_primary}">
<Label
Text="{Binding ArticulosTotales}"
TextColor="White">
</Label>
<Label
Text="ARTICULOS TOTALES"
TextColor="White">
</Label>
</StackLayout>
</StackLayout>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我做错了什么?我应该如何构造我的XAML代码?有什么帮助吗?当您需要向只接受一个子控件的控件添加多个视图时,可以通过将它们包装到布局容器堆栈、网格等中来实现
<ViewCell>
<StackLayout>
<Frame/>
<Frame/>
<Frame/>
</StackLayout>
</ViewCell>
使用布局容器堆栈、网格等在ViewCell中包装您的框架是否每个框架都是ListView中的单独项目?或者您希望每个ListView项目显示多个框架吗?我希望ListView中的每个项目显示多个@Maxhampton您可以建议一个答案吗@杰森