如何在xamarin.forms中的Listview中设置垂直滚动条

时间:2017-08-07 06:40:42

标签: xamarin.forms

我在页面的List视图中加载了数据。我能够在列表视图中滚动数据,但滚动时不显示任何垂直滚动条。请提出建议,如何在列表视图中设置垂直滚动条。

示例代码:

<ListView BackgroundColor="Transparent" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
ItemsSource="{Binding DataList}" HeightRequest="{Binding DataListRowHeight}" HasUnevenRows="true" HorizontalOptions="CenterAndExpand" RowHeight="40" SeparatorColor="Transparent"
SelectedItem="null">
                  <ListView.ItemTemplate>
                    <DataTemplate>
                      <ViewCell>
                        <Grid Padding="0,0,0,0">
                          <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                          </Grid.ColumnDefinitions>
                          <Grid.GestureRecognizers>
                            <TapGestureRecognizer Tapped="OnItemClicked"/>
                          </Grid.GestureRecognizers>
                          <Label Text="{Binding WindowName}" Grid.Column="0" TextColor="Black" FontFamily="Avenir Book" HorizontalTextAlignment="Start" VerticalTextAlignment="Center">                                
                          </Label>
                          <StackLayout Orientation="Horizontal" Grid.Column= "1">
                            <Label Text="Curtain Type:" TextColor="Black" FontFamily="Avenir Book" FontAttributes="Bold" HorizontalTextAlignment="Start" VerticalTextAlignment="Center">                                
                            </Label>
                            <Label Text="{Binding Data}" TextColor="Black" FontFamily="Avenir Book" HorizontalTextAlignment="Start" VerticalTextAlignment="Center">                                  
                            </Label>
                          </StackLayout>
                        </Grid>
                      </ViewCell>
                    </DataTemplate>
                  </ListView.ItemTemplate>
                </ListView>

上面是第二个listview示例代码。

0 个答案:

没有答案