我一直在嘗試動態創建控件,到目前為止,它一直在起作用。但是我的問題是布局<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 回答
- 0 關注
- 351 瀏覽
添加回答
舉報
0/150
提交
取消