xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.9k stars 878 forks source link

Change the Font on the Material Tab #1702

Closed ZionGates closed 2 years ago

ZionGates commented 2 years ago

Greetings, I'm using the MaterialTabControl and I like the cool animations however I can't seem to find the setting to change the Font on the Tabs themselves (where you click to change the tab page). Please assist.

ZionGates commented 2 years ago

Also can the tabs be aligned to the Center instead of being left aligned?

XceedBoucherS commented 2 years ago

Hello, To change the font Color on the MaterialTabItems, simply set a Foreground on each of them: <xctk:MaterialTabItem Header="First" HorizontalContentAlignment="Center" Content="MaterialTabItem 1" Foreground="Green"/>

Or set a style from the MaterialTabControl: <xctk:MaterialTabControl x:Name="materialTabControl" TabStripPlacement="Top" IsInkEffectActive="True" IsInkBarActive="True" IsSlidingAnimationActive="True">

For MaterialTabItem alignment, the tabs are always aligned to left, just like a standard TabControl with its TabItems aligned to left.
ZionGates commented 2 years ago

Greetings, thanks for responding, I'm trying to set the FONT Family, not color. Like Arial, Verdana, etc. Also I need a code behind answer, no xaml. This control is being generated at runtime.

XceedBoucherS commented 2 years ago

Hi, To modify the FontFamily instead of the Foreground, just replace the Foreground with FontFamily in the preceding example.

To do it in code-behind, you can do the same: -For all the MaterialTabItems: var myStyle = new Style( typeof( MaterialTabItem ) ); myStyle.Setters.Add( new Setter( FontFamilyProperty, new FontFamily("Wingdings") ) ); materialTabControl.Resources.Add( typeof( MaterialTabItem ), myStyle );

-For a specific MaterialTabItem: _materialTabItem.FontFamily = new FontFamily( "Wingdings" );

Thank you

ZionGates commented 2 years ago

Hi, To modify the FontFamily instead of the Foreground, just replace the Foreground with FontFamily in the preceding example.

To do it in code-behind, you can do the same: -For all the MaterialTabItems: var myStyle = new Style( typeof( MaterialTabItem ) ); myStyle.Setters.Add( new Setter( FontFamilyProperty, new FontFamily("Wingdings") ) ); materialTabControl.Resources.Add( typeof( MaterialTabItem ), myStyle );

-For a specific MaterialTabItem: _materialTabItem.FontFamily = new FontFamily( "Wingdings" );

Thank you

Thanks, that helped me.