Tab Control Content Presenter gets Local Vertical Alignment Top instead of respecting the control template
Posted: 26 Apr 2024, 15:39
Hello everyone, I am currently creating a template for TabControl and for some reason, there is a discrepancy between what is displayed on Blend and what is displayed in unreal.
This is the Control Template I have assigned to the TabControl :
When displayed in game, the content of the TabControl doesn't expand vertically as if it was VerticalAlignment=Top and, indeed, upon investigation on the Inspector, it looks like there is a local value attached as Top instead of stretched. see the image below.
I have tried both using VerticalAlignment={TemplateBinding VerticalContentAlignment} and not put any value. It always goes to Top after reimport + play in the engine.
Is there anything I might be missing here ?
This is the Control Template I have assigned to the TabControl :
Code: Select all
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="#FFAAAAAA" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TabPanel x:Name="HeaderPanel" Grid.Row="0" Panel.ZIndex="1" Margin="0,0,4,-1"
IsItemsHost="True" KeyboardNavigation.TabIndex="1" Background="Transparent" />
<Border x:Name="Border" Grid.Row="1" BorderThickness="0" KeyboardNavigation.TabNavigation="Local"
KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" >
<ContentPresenter x:Name="PART_SelectedContentHost"
Margin="4"
ContentSource="SelectedContent"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Border>
</Grid>
</ControlTemplate>
Is there anything I might be missing here ?