Alex Sorokoletov
Top achievements
Rank 1
Alex Sorokoletov
asked on 10 Feb 2011, 12:55 PM
Guys, I need to change default font family and size for all text-elements.
I use 2010 Q3 version of your toolkit
All textblocks I use in my XAMLs are okay. But textblocks inside Ribbon are still using Portable User Interface of size 11.
I use 2010 Q3 version of your toolkit
<
Style
x:Key
=
"BaseTextBlockStyle"
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"FontFamily"
Value
=
"Arial"
/>
<
Setter
Property
=
"FontSize"
Value
=
"12"
/>
</
Style
>
<
Style
TargetType
=
"TextBlock"
BasedOn
=
"{StaticResource BaseTextBlockStyle}"
>
</
Style
>
All textblocks I use in my XAMLs are okay. But textblocks inside Ribbon are still using Portable User Interface of size 11.
7 Answers, 1 is accepted
0
Hi Alex Sorokoletov,
If you set a Style with no Key as a UserControl's resource, that style will be applied to all elements of the targeted type in the UserControl. Therefore if you define a UserControl like so:
The style defined in the Resources will be applied to all TextBlocks n the UserControl - in this case both TextBlocks should have the same Foreground, FontSize and FontFamily. Give this a try and let us know if it works for you or if I am missing something
Greetings,
Tina Stancheva
the Telerik team
If you set a Style with no Key as a UserControl's resource, that style will be applied to all elements of the targeted type in the UserControl. Therefore if you define a UserControl like so:
<
UserControl.Resources
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"FontFamily"
Value
=
"Arial"
/>
<
Setter
Property
=
"FontSize"
Value
=
"12"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Red"
/>
</
Style
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadRibbonBar
VerticalAlignment
=
"Top"
>
<
telerik:RadRibbonTab
Header
=
"Tab 1"
>
<
telerik:RadRibbonGroup
Header
=
"Group 1"
>
<
StackPanel
>
<
telerik:RadRibbonButton
Content
=
"Button 1"
/>
<
telerik:RadRibbonButton
Content
=
"Button 2"
/>
<
TextBlock
Text
=
"TextBlock"
/>
</
StackPanel
>
<
telerik:RadRibbonButton
Content
=
"Button 3"
/>
<
telerik:RadRibbonButton
Content
=
"Button 4"
/>
</
telerik:RadRibbonGroup
>
</
telerik:RadRibbonTab
>
</
telerik:RadRibbonBar
>
<
TextBlock
Grid.Row
=
"1"
VerticalAlignment
=
"Top"
Text
=
"TextBlock"
/>
</
Grid
>
The style defined in the Resources will be applied to all TextBlocks n the UserControl - in this case both TextBlocks should have the same Foreground, FontSize and FontFamily. Give this a try and let us know if it works for you or if I am missing something
Greetings,
Tina Stancheva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Alex Sorokoletov
Top achievements
Rank 1
answered on 11 Feb 2011, 09:16 AM
With way you provided style is not applied to textblocks in RadContextMenu and RadWindow
0
Alex Sorokoletov
Top achievements
Rank 1
answered on 11 Feb 2011, 09:20 AM
And tooltips
0
Hi Alex,
In order to apply the style to all TextBlock controls in your application, I would suggest you to define the style not in the UserControl.Resources, but in the App.xaml.
Best wishes,
George
the Telerik team
In order to apply the style to all TextBlock controls in your application, I would suggest you to define the style not in the UserControl.Resources, but in the App.xaml.
Best wishes,
George
the Telerik team
0
Alex Sorokoletov
Top achievements
Rank 1
answered on 17 Feb 2011, 05:38 PM
I tried, but it didn't help.
0
Hello Alex,
We have some ideas of a new theming mechanism that will eventually style TextBlock but it will not be available anytime soon. For now the only solution would be to add Foreground to the controls that have problems.
Regards,
Pana
the Telerik team
We have some ideas of a new theming mechanism that will eventually style TextBlock but it will not be available anytime soon. For now the only solution would be to add Foreground to the controls that have problems.
Regards,
Pana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Hi Alex,
Also the following blog about the new GroupBox, Label and ToolTip controls and themes may be useful. They will be available in the upcoming beta and official Q1 release. Also the 3 controls are present in Internal builds.
Kind regards,
Pana
the Telerik team
Also the following blog about the new GroupBox, Label and ToolTip controls and themes may be useful. They will be available in the upcoming beta and official Q1 release. Also the 3 controls are present in Internal builds.
Kind regards,
Pana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!