Xaml 如何创建像邮件这样的边计数列表视图

Xaml 如何创建像邮件这样的边计数列表视图,xaml,listview,xamarin,xamarin.forms,label,Xaml,Listview,Xamarin,Xamarin.forms,Label,我正在使用Xamarin.forms小应用程序。现在我对如何在标签中计数和显示列表项有疑问 比如电子邮件和gmail。 我在谷歌浏览各种网站,但没有得到结果 下面是我的Xaml代码,说明了如何在侧栏中显示计数,我使用了网格表示该总和Xaml。任务错误将发生 <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

我正在使用Xamarin.forms小应用程序。现在我对如何在标签中计数和显示列表项有疑问 比如电子邮件和gmail。 我在谷歌浏览各种网站,但没有得到结果

下面是我的Xaml代码,说明了如何在侧栏中显示计数,我使用了网格表示该总和Xaml。任务错误将发生

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:emit="clr-namespace:System.Reflection.Emit;assembly=mscorlib"
             x:Class="vMonitor.Views.HomeListView"
             Title="Home List View"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008">

    <ScrollView>
        <StackLayout Orientation="Vertical">

            <ListView ItemsSource="{Binding Model}" Margin="20,0,20,0"
                      x:Name="listView"
                      SeparatorVisibility="Default" SeparatorColor="Brown"
                      HasUnevenRows="True">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Grid>
                                <StackLayout Orientation="Horizontal" Padding="10">
                                    <Label Text="{Binding Name}" FontSize="20" FontFamily="TimesNewRomen" FontAttributes="None">
                                        <Label.GestureRecognizers>
                                            <TapGestureRecognizer Command="{Binding Path=BindingContext.TabCommand, Source={x:Reference listView}}" CommandParameter="{Binding .}"/>
                                        </Label.GestureRecognizers>
                                    </Label>
                                    <Label Text="{Binding UserID}" FontSize="20" FontFamily="TimesNewRomen" FontAttributes="None"/>

                                </StackLayout>

                            </Grid>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ScrollView>

</ContentPage>

然后您可以对列表项使用
ViewCell

    <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout Padding="15,10" Orientation="Horizontal">                           
                            <Label 
                                 VerticalTextAlignment="Center" 
                                Text="{Binding ItemName}"  TextColor="#FF1654" FontAttributes="Bold" FontSize="16"/>
                            <Label VerticalOptions="End" 
                                 VerticalTextAlignment="Center" 
                                Text="{Binding ItemCount}"  TextColor="#FF1654" FontAttributes="Bold" FontSize="16"/>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>

您可以绑定ItemName和ItemCount。如果要显示左侧图像,则可以在
ViewCell
的起始位置添加
Image


要实现可扩展,您必须为该单元格使用IsVisible属性。

您需要有关UI布局的帮助吗?或者你不知道如何从你的模型中得到计数?你具体需要什么帮助?我需要帮助来设计UI