XamarinForm Listview ViewCell高度根据内容设置Dynamicaly

时间:2016-10-19 09:27:02

标签: listview xamarin xamarin.ios xamarin.forms

我正在使用Listview根据内容设置的Viewcell高度。当我为Listview设置属性 HasUnevenRows = True 时,为Windows和Android工作正常但是对于Ios它不能正常工作。< / p>

 <ListView x:Name="LstNotification"
            Grid.Row="0"
            HasUnevenRows="True"
            SeparatorVisibility="None">
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <Grid BorderColor="#A4C0D4" InnerBackground="#fafcff" BorderWidth="2" Margin="10,5" >
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <StackLayout Grid.Row="0" Margin="10,5">
                <Label Text="Know Your Medicine" TextColor="#1a1b1c" LineBreakMode="WordWrap" FontAttributes="Bold"/>
                <Label Text="{Binding message}" TextColor="#1a1b1c" LineBreakMode="WordWrap"/>
              </StackLayout>
              <Grid Grid.Row="1" InnerBackground="#d8dbdd" HeightRequest="1"/>
              <Grid Grid.Row="2" Margin="10,5">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="7.5*"/>
                  <ColumnDefinition Width="2.5*"/>
                </Grid.ColumnDefinitions>
                <Label Grid.Column="0" TextColor="#8b8d8e" FontAttributes="None" Margin="0,5"/>
                <Image Grid.Column="1" Source="bin.png" HeightRequest="15"
                       WidthRequest="15" HorizontalOptions="EndAndExpand" Margin="0,0,10,0"/>
              </Grid>
            </Grid>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

0 个答案:

没有答案