开发者

Automatically Size WPF Frame Object inside TabItem/StackPanel

开发者 https://www.devze.com 2023-01-11 12:20 出处:网络
I want the Frame Control to automatically resize to fill the screen inside my TabItem.Is the following 开发者_运维技巧code it renders a very small frame.I would rather not set static heigh and width.H

I want the Frame Control to automatically resize to fill the screen inside my TabItem. Is the following 开发者_运维技巧code it renders a very small frame. I would rather not set static heigh and width. Here is the 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>


This worked, the key part being not setting the second RowDefinition Height="Auto" but the first row needs to have it set or the frame only fills about 1/2 of the screen, go figure...

            <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>


<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> 
0

精彩评论

暂无评论...
验证码 换一张
取 消