1

我希望 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>
4

2 回答 2

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>
于 2010-08-12T15:44:34.897 回答
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> 
于 2010-08-12T13:53:46.080 回答