Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stretch the wpf tab control content

Tags:

wpf

xaml

I am trying to stretch the wpf tab control content for fit the screen when it resizes even if the tab item is empty. There doesnt seem to be a stretch property?

like image 478
Dave Jones Avatar asked Dec 16 '25 19:12

Dave Jones


1 Answers

I just tried the code below and the rectangle seemed to to stretch correctly. The TabControl also stretched correctly if I removed the Border & Rectangle from the TabItem. Maybe I'm not understanding what you mean by 'empty,' but give this a try.

<Grid>
    <TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <TabItem Header="Item 1" Name="tabItem1">
            <Border Margin="5" BorderBrush="Red" BorderThickness="3">
                <Rectangle Fill="Pink" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            </Border>
        </TabItem>
    </TabControl>
</Grid>
like image 155
JSprang Avatar answered Dec 20 '25 03:12

JSprang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!