Xaml 将边框设置为listview Xamarin表单

Xaml 将边框设置为listview Xamarin表单,xaml,xamarin.forms,Xaml,Xamarin.forms,我用xamarin表单创建了一个表,但我希望标题不要有空格,也不要放边框,使用表条带,例如具有引导表的基本特征。你能帮我吗?。谢谢你的帮助 这是我的密码 <StackLayout BindingContext="{Binding OpportunityListViewModel}" Padding="8"> <ListView x:Name="ProposalListProduct" ItemsSource="{Binding

我用xamarin表单创建了一个表,但我希望标题不要有空格,也不要放边框,使用表条带,例如具有引导表的基本特征。你能帮我吗?。谢谢你的帮助

这是我的密码

 <StackLayout BindingContext="{Binding OpportunityListViewModel}" Padding="8">
        <ListView x:Name="ProposalListProduct"
                ItemsSource="{Binding ProposalView}"
                IsRefreshing="{Binding IsRefreshing}"
                CachingStrategy="RecycleElement"
                HasUnevenRows="True"
                 Margin="0">
            <ListView.Header>
                <Grid Margin="0" Padding="0" RowSpacing="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50*" />
                        <ColumnDefinition Width="10*" />
                        <ColumnDefinition Width="20*" />
                        <ColumnDefinition Width="20*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20" />
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Margin="0" Text="Item" FontSize="8" TextColor="Black" BackgroundColor="LightGray" HorizontalTextAlignment="Center" HorizontalOptions="Fill" />
                    <Label Grid.Row="0" Grid.Column="1" Margin="0" Text="Cant."  FontSize="8" TextColor="Black" BackgroundColor="LightGray" HorizontalTextAlignment="Center" HorizontalOptions="Fill" />
                    <Label Grid.Row="0" Grid.Column="2" Margin="0" Text="Precio"  FontSize="8" TextColor="Black" BackgroundColor="LightGray" HorizontalTextAlignment="Center" HorizontalOptions="Fill" />
                    <Label Grid.Row="0" Grid.Column="3" Margin="0" Text="Total"  FontSize="8" TextColor="Black" BackgroundColor="LightGray" HorizontalTextAlignment="Center" HorizontalOptions="Fill" />

                </Grid>
            </ListView.Header>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <Grid Margin="0" Padding="0" RowSpacing="0" ColumnSpacing="0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50*" />
                                    <ColumnDefinition Width="10*" />
                                    <ColumnDefinition Width="20*" />
                                    <ColumnDefinition Width="20*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20"  />
                                </Grid.RowDefinitions>
                                <Label Grid.Column="0" Margin="0" x:Name="Nombre" Text="{Binding Nombre}" FontSize="8" TextColor="Black" VerticalTextAlignment="End" HorizontalTextAlignment="Start" />
                                <Label Grid.Column="1" Margin="0" x:Name="Cantidad" Text="{Binding Cantidad}" FontSize="8" TextColor="Black" VerticalTextAlignment="End" HorizontalTextAlignment="End"/>
                                <Label Grid.Column="2" Margin="0" x:Name="Precio" Text="{Binding Precio,StringFormat='{0:C2}'}" FontSize="8" TextColor="Black" VerticalTextAlignment="End" HorizontalTextAlignment="End"/>
                                <Label Grid.Column="3" Margin="0" x:Name="Total" Text="{Binding Total,StringFormat='{0:C2}'}" FontSize="8" TextColor="Black" VerticalTextAlignment="End" HorizontalTextAlignment="End"/>
                            </Grid>
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>

您可以这样做:

<ListView ItemsSource="{Binding People}"
              HasUnevenRows="True"
              SeparatorVisibility="None">

        <ListView.Header>
            <Frame>
                <Grid>

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

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Text="Name"
                           HorizontalOptions="Center"
                           FontSize="Large"/>
                    <Label Grid.Column="1"
                       Text="Description"
                           HorizontalOptions="Center"
                           FontSize="Large"/>

                    <BoxView Grid.Row="1"
                             Grid.ColumnSpan="2"
                             HeightRequest="1"
                             BackgroundColor="LightGray"/>
                </Grid>
            </Frame>
        </ListView.Header>

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid Margin="20,10">

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

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <Label Text="{Binding Name}"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                        <Label Grid.Column="1"
                               Text="{Binding Description}"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>

                        <BoxView Grid.Row="1"
                             Grid.ColumnSpan="2"
                             HeightRequest="1"
                             BackgroundColor="LightGray"/>
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>


Grid在标题中,将列间距设置为“0”。对于边框,可以将每个标题标签放在框架内,并将框架的边框颜色放在框架内。@Guillermo,border shadow using frame,您可以查看: