Specify FontWeight for buttons

Thread is closed for posting
4 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    6 posts
    Member since:
    May 2011

    Posted 07 Nov 2011 Link to this post


    I'm using the MessageBox control and I need to display a list of choices to my users. In my case, I need each button to be a simple text. In order to do that, I've come up with the following XAML:

    <ControlTemplate x:Key="shareMessageBoxTemplate"
                    Background="{StaticResource PhoneChromeBrush}">
                    <Style TargetType="Button">
                            <Setter Property="Template">
                                    <ControlTemplate TargetType="Button">
                                            Text="{TemplateBinding Content}"
                    <ContentControl x:Name="PART_Title" Visibility="Collapsed"/>
                    <ContentControl x:Name="PART_Message" Visibility="Collapsed"/>
                    <CheckBox x:Name="PART_CheckBox" Visibility="Collapsed"/>
                                <StackPanel x:Name="PART_ButtonsPanel"/>

    The problem is that the 
    option does not seems to be taken into account (the text is still rendered using a bold style).

    Am I missing something ? I've also tried to set the resources in the Resources section of the ContentControl but it doesn't work either.

  2. Victor
    Victor avatar
    1358 posts

    Posted 07 Nov 2011 Link to this post

    Hello Jeremy,

     Thank you for writing.
    I am afraid that I have no idea why your XAML does not work. It looks like it should. I tried setting ExtraLight as font weight for a standalone TextBlock on an empty page and it does not have any effect. Perhaps the ExtraLight value is broken in the WindowsPhone Silverlight. There seems to be no difference between ExtraLight and Normal.

    Please write again if you need assistance with our controls.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Jeremy
    Jeremy avatar
    6 posts
    Member since:
    May 2011

    Posted 08 Nov 2011 Link to this post

    Ok I found the issue (based on this thread):Font selection is a bit of a mess. You can select FontWeight for some typefaces such as Verdana, but for Segoe WP they created a separate FontFamily for each weight. Instead of FontWeight you would select FontFamily="Segoe WP Light"

    In my case, changing the FontWeight="ExtraLight" to FontFamily="Segoe WP Light" did the trick.
  4. Vitalii
    Vitalii avatar
    104 posts
    Member since:
    Jul 2013

    Posted 14 May 2014 in reply to Jeremy Link to this post

    Hey, Jeremy, thanks for info! That one is still actual, at least for wp7.
Back to Top