无法在DataTemplate中使用网格

时间:2015-08-09 22:37:41

标签: xamarin.forms

我无法在DataTemplate中使用网格。 具体而言,使用网格时不会呈现文本。

    <ListView ItemsSource="{Binding Services}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>

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

                                <Label Grid.Row="0" Grid.ColumnSpan="2"  Text="{Binding Name}" />
                                <Label Grid.Row="1" Grid.Column="0" Text="Labor:" />
                                <Label Grid.Row="1" Grid.Column="1" Text="{Binding LaborCost}" />

                                <Label Grid.Row="2" Grid.Column="0" Text="Materials:" />
                                <Label Grid.Row="2" Grid.Column="1" Text="{Binding Materials, Converter={StaticResource MaterialsToCostConverter}}" />

                                <Label Grid.Row="3" Grid.ColumnSpan="2" Text="{Binding Description}" />
                            </Grid>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

有什么建议吗?

0 个答案:

没有答案