Default font size and family

8 posts, 0 answers
  1. Alex Sorokoletov
    Alex Sorokoletov avatar
    15 posts
    Member since:
    Dec 2009

    Posted 10 Feb 2011 Link to this post

    Guys, I need to change default font family and size for all text-elements.
    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.

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3299 posts

    Posted 10 Feb 2011 Link to this post

    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:
    <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>>
  3. Alex Sorokoletov
    Alex Sorokoletov avatar
    15 posts
    Member since:
    Dec 2009

    Posted 11 Feb 2011 Link to this post

    With way you provided style is not applied to textblocks in RadContextMenu and RadWindow
  4. Alex Sorokoletov
    Alex Sorokoletov avatar
    15 posts
    Member since:
    Dec 2009

    Posted 11 Feb 2011 Link to this post

    And tooltips
  5. George
    Admin
    George avatar
    1332 posts

    Posted 17 Feb 2011 Link to this post

    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
  6. Alex Sorokoletov
    Alex Sorokoletov avatar
    15 posts
    Member since:
    Dec 2009

    Posted 17 Feb 2011 Link to this post

    I tried, but it didn't help.
  7. Pana
    Admin
    Pana avatar
    748 posts

    Posted 23 Feb 2011 Link to this post

    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
    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!
  8. Pana
    Admin
    Pana avatar
    748 posts

    Posted 23 Feb 2011 Link to this post

    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
    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!
Back to Top