我希望Frame Control自动调整大小以填充我的TabItem中的屏幕。以下代码是否呈现一个非常小的框架。我宁愿不设置静态高度和宽度。这是XAML
<TabItem Header="Reports" Name="tReports" Height="50" BorderBrush="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ComboBox Grid.Row="0" Name="cmbReport" Width="200" HorizontalAlignment="Left" />
<Frame Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Source="http://online/home/" Margin="0,15,0,0" />
</Grid>
</TabItem>
答案 0 :(得分:2)
这很有效,关键部分是没有设置第二个RowDefinition Height =“Auto”,但是第一行需要设置它或者帧只填充大约1/2的屏幕,去图...
<TabItem Header="Reports" Name="tReports" Height="50" BorderBrush="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ComboBox Grid.Row="0" Name="cmbReport" Width="200" HorizontalAlignment="Left">
</ComboBox>
<Frame Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Source="http://online/home/" Margin="0,15,0,0" />
</Grid>
</TabItem>
答案 1 :(得分:1)
<TabItem Header="Reports" Name="tReports" Height="50" BorderBrush="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="100">
<Grid>
<Frame HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Source="http://google.com" />
</Grid>
</TabItem>