locked
how to change default font for all ui control? RRS feed

  • Question

  • how to change default font for all ui control?
    Thursday, January 8, 2015 7:12 AM

Answers

  • Hi Estmob,

    You can add style definition in App.xaml like the following code snippet. Don’t use “x:key” property, then that style will apply to all type of that control. So if you want to apply to other control, you need to define that control type.

      <Application.Resources>
    
            <Style TargetType="Button" >
    
                <Setter Property="FontSize" Value="50"></Setter>
    
            </Style>
    
            <Style TargetType="TextBox">
    
                <Setter Property="FontSize" Value="60"></Setter>
    
                <Setter Property="Height" Value="120"></Setter>
    
            </Style>
    
    </Application.Resources>
    

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Friday, January 9, 2015 8:49 AM

All replies

  • Probably you can define style tags in app.xaml file for each type of control used in the project and use the reference of that style whenever to define the control of that type in xaml files.

    e.g. for a TextBlock : 

    // In app.xaml
    
    <Style x:Key="TextBlockStyle" TargetType="TextBlock">
                <Setter Property="FontSize" Value="26"/>
                <Setter Property="FontFamily" Value="Arial"/>
                <Setter Property="FontWeight" Value="SemiBold"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="Margin" Value="10,0,0,0"/>
            </Style>
    
    //usage in page.xaml file
    
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                  
                </Grid.RowDefinitions>
     
                <TextBlock Grid.Row="0" Text="Name : " Style="{StaticResource TextBlockStyle}"/>


    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

    Thursday, January 8, 2015 7:41 AM
  • hi

    you can go to tools-->option--> font and color   and change default font and size and color.


    Amir Ameri

    Thursday, January 8, 2015 7:48 AM
  • you can go to tools-->option--> font and color and change default font and size and color.

    That's for the Visual Studio IDE, not the app.

    Thursday, January 8, 2015 9:13 AM
  • Hi Estmob,

    You can add style definition in App.xaml like the following code snippet. Don’t use “x:key” property, then that style will apply to all type of that control. So if you want to apply to other control, you need to define that control type.

      <Application.Resources>
    
            <Style TargetType="Button" >
    
                <Setter Property="FontSize" Value="50"></Setter>
    
            </Style>
    
            <Style TargetType="TextBox">
    
                <Setter Property="FontSize" Value="60"></Setter>
    
                <Setter Property="Height" Value="120"></Setter>
    
            </Style>
    
    </Application.Resources>
    

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Friday, January 9, 2015 8:49 AM