嵌套的StackLayout不在DataTemplate中呈现

时间:2015-08-09 22:53:31

标签: xamarin.forms

我观察到嵌套的StackLayout无法在DataTemplate中完全呈现。

具体来说,只会呈现name,labor和LaborCost。忽略所有其他值。

    <ListView ItemsSource="{Binding Services}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <StackLayout Orientation="Vertical">
                            <Label Text="{Binding Name}" />
                            <StackLayout Orientation="Horizontal">
                                <Label Text="Labor:" />
                                <Label Text="{Binding LaborCost}" />
                            </StackLayout>

                            <StackLayout Orientation="Horizontal">
                                <Label Text="Materials:" />
                                <Label Text="{Binding Materials, Converter={StaticResource MaterialsToCostConverter}}" />
                            </StackLayout>

                            <Label Text="{Binding Description}" />
                        </StackLayout>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

向ListView添加了以下属性:

  

HasUnevenRows =&#34;真&#34;