MaterialDesign WPF TabControl Header #3180
-
How to change height of the TabItem Header in TabControl?
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
@ProgramistaZaDyszke The Also, you can see the an example of the first solution in this issue: #3150 |
Beta Was this translation helpful? Give feedback.
-
When changing height of tabItem only this section changes its height: I understand that this grid stays behind with default height. Question is how to access it to change height of tabItem header without changing whole style? Otherwise using material themes doesn't have sense if I will have to rewrite whole style again. |
Beta Was this translation helpful? Give feedback.
-
@ProgramistaZaDyszke I think you have probably set it on I took your code above and simply added <materialDesign:Card>
<TabControl materialDesign:ColorZoneAssist.Mode="PrimaryMid" Style="{StaticResource MaterialDesignFilledTabControl}">
<TabItem Header="TAB 1" Height="100">
<TextBlock Margin="8" Text="PrimaryMid Tab 1" />
</TabItem>
<TabItem Header="TAB 2">
<TextBlock Margin="8" Text="PrimaryMid Tab 2" />
</TabItem>
</TabControl>
</materialDesign:Card> Naturally, setting it on one |
Beta Was this translation helpful? Give feedback.
-
@nicolaihenriksen yes because you can increase height above 48 without any problem but you cannot go below this number. Let's say I want header to be 35 and this will not work. |
Beta Was this translation helpful? Give feedback.
-
@ProgramistaZaDyszke I had a look at the templates. I think you're being hit by the default padding applied to the <materialDesign:Card>
<TabControl materialDesign:ColorZoneAssist.Mode="PrimaryMid" Style="{StaticResource MaterialDesignFilledTabControl}">
<TabItem Header="TAB 1" Height="20" Padding="0">
<TextBlock Margin="2" Text="PrimaryMid Tab 1" />
</TabItem>
<TabItem Header="TAB 2" Height="20" Padding="0">
<TextBlock Margin="2" Text="PrimaryMid Tab 2" />
</TabItem>
</TabControl>
</materialDesign:Card> |
Beta Was this translation helpful? Give feedback.
@ProgramistaZaDyszke I had a look at the templates. I think you're being hit by the default padding applied to the
TabItem
. If you explicitly override that (ideally via a style), you can also get "shorter tabs". In the example below I have explicitly setHeight=20
andPadding=0
just to showcase this.