我的状态栏出了点问题。 在我的xaml
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Buttons etc... />
<DataGrid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding DataFields}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<DataGridTextColumn Header="Type" Binding="{Binding FieldType}" />
<DataGridTextColumn Header="Unit" Binding="{Binding Unit}" />
<DataGridTemplateColumn Header="Values">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="{x:Type model:DataField}">
<ComboBox ItemsSource="{Binding Values}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" >
<ProgressBar
Height="31"
Minimum="0"
Maximum="50"
Value="{Binding CurrentProgress}" />
<TextBlock Text="{Binding CurrentProgressPercentage, StringFormat={}{0:0}%}" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding ProgressVisibility}" />
</Grid>
</Grid>
当我的App加载时,datagrid为空,带状态栏的Grid位于窗口中间。我希望它坚持我的应用程序的底部边框。因此我试图使用DockPanel而不是Grid,但这也不起作用,因为我的网格在加载应用程序时是空的。我正在考虑添加一个虚拟网格行,但我无法提出解决方案......
有人能给我一个简单的解决方案吗?
谢谢!
答案 0 :(得分:1)
当您将修复高度分配给包含进度条的网格行时,它应该会有所帮助,因此将Grid.RowDefinitions更改为:
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>