Dockpanel多个文本块大小
本文关键字:文本 Dockpanel | 更新日期: 2023-09-27 18:04:09
我想用9个文本块填充我的Dock面板。我想文本块,以填补整个码头面板。我将高度设置为自动,垂直/水平对齐为拉伸。
文本块,但是,不填满整个dock面板。你知道哪里出了问题吗。由于
我的dockpanel位于网格中。
<Border DockPanel.Dock="Top" Background="White" BorderBrush="DodgerBlue" BorderThickness="5,5,5,5" CornerRadius="10" Margin="2" Height="700">
<DockPanel >
<TextBlock DockPanel.Dock="Top" Name="txtID" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">1</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtOAG" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">2</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtFAILURE_ID" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">3</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtWIDTH" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">4</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtHeight" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">5</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtBARCODE_READ" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">6</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtBARCODE_NUM" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">7</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtANOMOLY" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">8</TextBlock>
<TextBlock DockPanel.Dock="Top" Name="txtTRACECODE" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto">9</TextBlock>
</DockPanel>
</Border>
DockPanel
"停靠"到两侧,StackPanel
"堆叠"在一起。你应该使用Grid
像这样(以3行为例):
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="1" />
<TextBlock Grid.Row="1" Text="2" />
<TextBlock Grid.Row="2" Text="3" />
</Grid>