所以我有WPF
应用程序:
<Grid Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="270" />
<RowDefinition Height="200" />
<RowDefinition Height="260" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
</Grid>
在最近Row
我有StatusBar
:
<Grid Name="gridStatusBar" Grid.Row="3" Margin="0,0,0,0">
<StatusBar>
<StatusBarItem HorizontalAlignment="Left">
<Label
FontSize="13"
FontFamily="Comic Sans MS"
Foreground="Gainsboro"
Margin="0,-3,0,0"/>
</StatusBarItem>
</StatusBar>
</Grid>
因此,在调整应用程序大小的情况下,我看不到我的StatusBar
,我尝试添加VerticalAlignment="Bottom"
并VerticalAlignment="Top"
但这仍然 无济于事。
您的Grid
实际上具有 270 + 200 + 260 + 30 = 760 的固定高度。
如果您希望它能够动态收缩和增长,则应使用相对(星形 *(大小:
<Grid.RowDefinitions>
<RowDefinition Height="270*" />
<RowDefinition Height="200*" />
<RowDefinition Height="260*" />
<RowDefinition Height="30" /> <!-- only this height is actually fixed -->
</Grid.RowDefinitions>
另一种选择是 使用另一种Panel
,例如DockPanel
并始终将StatusBar
停靠在底部:
<DockPanel>
<Grid Name="gridStatusBar" Height="30" DockPanel.Dock="Bottom" Margin="0,0,0,0">
<StatusBar>
<StatusBarItem HorizontalAlignment="Left">
<Label
FontSize="13"
FontFamily="Comic Sans MS"
Foreground="Gainsboro"
Margin="0,-3,0,0"/>
</StatusBarItem>
</StatusBar>
</Grid>
<Grid Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="270" />
<RowDefinition Height="200" />
<RowDefinition Height="260" />
</Grid.RowDefinitions>
</Grid>
</DockPanel>