Question

All, I have the following XAML in my main window

<TabControl ItemsSource="{Binding Path=Workspaces}" 
            Grid.Column="1" 
            Grid.ColumnSpan="3" 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Stretch" 
            TabStripPlacement="Top">
    <TabControl.ItemContainerStyle>
           <Style TargetType="TabItem">
              <Setter Property="Header" Value="{Binding Path=DisplayName}"/>
              <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
              <Setter Property="VerticalContentAlignment" Value="Stretch"/>
           </Style>
      </TabControl.ItemContainerStyle>    
</TabControl>

this is adding a TabItem with the desired content. But the content is not filling the TabItem/TabPage. Can someone tell me why?

Thanks for your time.

Was it helpful?

Solution

Converting my comments into an answer:

use Snoop to inspect the Visual Tree at runtime. That should give you a hint about what's going on.

Inspect the View and check what the Alignment properties are for each element inside the Content part of the TabControl. Also check to see if there's some fixed Width or Height on any element, which would prevent it from stretching

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top