Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tab Control Underline Position #3048

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource TabStripPlacementEnumValues}}"
SelectedItem="{x:Static Dock.Top}" />
SelectedItem="{x:Static Dock.Right}" />
</StackPanel>
<TabControl Height="200"
Controls:TabControlHelper.Underlined="{Binding ElementName=UnderlinedComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TabStripPlacement="{Binding ElementName=TabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
TabStripPlacement="{Binding ElementName=TabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Controls:TabControlHelper.UnderlinePosition="Right">
<TabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _1">
<TextBlock FontSize="30" Text="Content" />
</TabItem>
Expand Down Expand Up @@ -110,7 +110,7 @@
</Grid.Resources>
<TabControl Height="150"
Controls:TabControlHelper.Underlined="{Binding ElementName=AnimatedTabControlUnderlinedComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TabStripPlacement="{Binding ElementName=AnimatedTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
TabStripPlacement="{Binding ElementName=AnimatedTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Controls:TabControlHelper.UnderlinePosition="Left">
<TabItem Header="this tabcontrol">
<TextBlock FontSize="30" Text="Cool transition" />
</TabItem>
Expand Down Expand Up @@ -154,7 +154,7 @@
</Grid.Resources>
<TabControl Height="150"
Controls:TabControlHelper.Underlined="{Binding ElementName=AnimatedSingleRowTabControlUnderlinedComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TabStripPlacement="{Binding ElementName=AnimatedSingleRowTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
TabStripPlacement="{Binding ElementName=AnimatedSingleRowTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Controls:TabControlHelper.UnderlinePosition="Top">
<TabItem Header="these tabs">
<TextBlock FontSize="30" Text="first content" />
</TabItem>
Expand Down Expand Up @@ -202,7 +202,7 @@
</StackPanel>
<Controls:MetroAnimatedTabControl Height="150"
Controls:TabControlHelper.Underlined="{Binding ElementName=MetroAnimatedTabControlUnderlinedComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TabStripPlacement="{Binding ElementName=MetroAnimatedTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
TabStripPlacement="{Binding ElementName=MetroAnimatedTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Controls:TabControlHelper.UnderlinePosition="Bottom">
<TabItem Header="this tabcontrol">
<TextBlock FontSize="30" Text="Cool transition" />
</TabItem>
Expand Down Expand Up @@ -241,7 +241,7 @@
</StackPanel>
<Controls:MetroAnimatedSingleRowTabControl Height="150"
Controls:TabControlHelper.Underlined="{Binding ElementName=MetroAnimatedSingleRowTabControlUnderlinedComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TabStripPlacement="{Binding ElementName=MetroAnimatedSingleRowTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
TabStripPlacement="{Binding ElementName=MetroAnimatedSingleRowTabControlTabStripPlacementComboBox, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Controls:TabControlHelper.UnderlinePosition="Right">
<TabItem Header="these tabs">
<TextBlock FontSize="30" Text="first content" />
</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,30 @@ public static void SetTransition(DependencyObject obj, TransitionType value)
{
obj.SetValue(TransitionProperty, value);
}



/// <summary>
/// Defines the position of the <see cref="TabItem"/> Underline
/// </summary>

public static readonly DependencyProperty UnderlinePositionProperty =
DependencyProperty.RegisterAttached("UnderlinePosition",
typeof(Dock),
typeof(TabControlHelper),
new PropertyMetadata(Dock.Bottom)
);

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(TabControl))]
public static Dock GetUnderlinePosition(UIElement element)
{
return (Dock)element.GetValue(UnderlinePositionProperty);
}

public static void SetUnderlinePosition(UIElement element, Dock value)
{
element.SetValue(UnderlinePositionProperty, value);
}
}
}
Loading