-
Is there a way to Add A Toggle Button To MetroTabItem Header? I'm guessing I'd have to override a style, but I'm not sure where to start. Any suggestions? Kind of along the same lines of the original post... is there a way to make the padding between the button and header a bit smaller? The entire control tends to consume quite a bit of real estate. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@dknippel You can set the Note: If you click on the toggle button then the item will not be selected. <mah:MetroTabControl
mah:HeaderedControlHelper.HeaderMargin="6 0"
mah:HeaderedControlHelper.HeaderFontFamily="Segoe Script"
mah:HeaderedControlHelper.HeaderFontSize="18">
<mah:MetroTabControl.Resources>
<Style TargetType="{x:Type mah:MetroTabItem}" BasedOn="{StaticResource {x:Type mah:MetroTabItem}}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!-- Bind to the Header itself -->
<Label Content="{Binding}" />
<!-- Bind to a property of your ViewModel -->
<mah:ToggleSwitch MinWidth="0" Margin="8 0 0 0">Toggle</mah:ToggleSwitch>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</mah:MetroTabControl.Resources>
<mah:MetroTabItem Header="Item _1">
<TextBlock FontSize="30" Text="Content" />
</mah:MetroTabItem>
<mah:MetroTabItem Header="Item _2">
<TextBlock FontSize="30" Text="More content" />
</mah:MetroTabItem>
<mah:MetroTabItem Header="Item _3">
<TextBlock FontSize="30" Text="More more content" />
</mah:MetroTabItem>
<mah:MetroTabItem Header="Item _4">
<TextBlock FontSize="30" Text="So much content!" />
</mah:MetroTabItem>
<mah:MetroTabItem Header="Item _5">
<TextBlock FontSize="30" Text="Content!" />
</mah:MetroTabItem>
<mah:MetroTabItem Header="Item _6">
<TextBlock FontSize="30" Text="This is not content (it is)" />
</mah:MetroTabItem>
</mah:MetroTabControl> |
Beta Was this translation helpful? Give feedback.
Hmmm, this may not be the cleanest XAML/WPF way to do it, but this is all we had time for:
Which finally resulted in this: