我一直在尝试动态创建控件,到目前为止,它一直在起作用。但是我的问题是布局<Grid Grid.Row="2" > <ItemsControl IsTabStop="False" ItemsSource="{Binding ListControls}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="120*"/> <RowDefinition Height="120*"/> <RowDefinition/> </Grid.RowDefinitions> <Label Content="AN:" Margin="5,5,5,5" FontSize="14" VerticalContentAlignment="Center"/> <TextBox Grid.Column="1" FontSize="14" VerticalContentAlignment="Center" Margin="5,5,5,5"/> </Grid> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid>用上面的xaml。这是布局的屏幕截图如果我使用这样的xaml <Grid Grid.Row="2" > <ItemsControl IsTabStop="False" ItemsSource="{Binding ListControls}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"> <Label Content="AN:" Margin="5,5,5,5" FontSize="14" VerticalContentAlignment="Center"/> <TextBox Width="100" FontSize="14" VerticalContentAlignment="Center" Margin="5,5,5,5"/> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid>但是我的目标是,如果程序最大化,我希望文本框能够扩展。我如何调整xaml代码以扩展文本框?谢谢
1 回答
- 1 回答
- 0 关注
- 328 浏览
添加回答
举报
0/150
提交
取消