Xamarin使用混合的xaml和代码隐藏内容形成网格?
我想用xaml代码定义大多数行,只在代码隐藏中以编程方式添加一行,但我无法做到这一点 以下是我的XAML简化代码:Xamarin使用混合的xaml和代码隐藏内容形成网格?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我想用xaml代码定义大多数行,只在代码隐藏中以编程方式添加一行,但我无法做到这一点 以下是我的XAML简化代码: <Grid x:Name="gridTest"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <RowDefinition Height="*" /> <RowDefinition Height="auto"
<Grid x:Name="gridTest">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
</Grid>
<Label Grid.Row="0" Text="row 0"></Label>
<Label Grid.Row="1" Text="row 1"></Label>
输出仅为“第2行”
这真的不可能吗,还是我错过了什么
Tks您的XAML标签需要位于您的
标签内
<Grid x:Name="gridTest">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="row 0"></Label>
<Label Grid.Row="1" Text="row 1"></Label>
</Grid>
您的XAML标签需要位于您的
标签中
<Grid x:Name="gridTest">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="row 0"></Label>
<Label Grid.Row="1" Text="row 1"></Label>
</Grid>
谢谢,我忘了。谢谢,我忘了。