Double value as the Font size : Style « Windows Presentation Foundation « C# / C Sharp






Double value as the Font size

Double value as the Font size
    


<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:System;assembly=mscorlib">
    <Canvas.Resources>
        <FontFamily x:Key="fntfam">Times New Roman</FontFamily>
        <s:Double x:Key="fntsize">96</s:Double>

        <TransformGroup x:Key="xform">
            <ScaleTransform ScaleX="{Binding Source={StaticResource fntfam}, Path=Baseline}" />
            <ScaleTransform ScaleX="{StaticResource fntsize}" />
        </TransformGroup>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="{StaticResource fntfam}" />
            <Setter Property="FontSize" Value="{StaticResource fntsize}" />
            <Setter Property="Text" Value="Reflect" />
            <Setter Property="Canvas.Left" Value="400" />
            <Setter Property="Canvas.Top" Value="48" />
        </Style>
    </Canvas.Resources>

    <TextBlock>asdf</TextBlock>


</Canvas>

   
    
    
    
  








Related examples in the same category

1.FontFamily resource constantFontFamily resource constant
2.Styles With Same KeysStyles With Same Keys
3.Setter With Binding to SliderSetter With Binding to Slider
4.Style With Data TriggerStyle With Data Trigger
5.Styles With Target TypesStyles With Target Types
6.Style With Multiple ElementsStyle With Multiple Elements
7.Style With Multiple ButtonsStyle With Multiple Buttons
8.Style With ResourceStyle With Resource
9.Style With Property ElementStyle With Property Element
10.Style With TriggersStyle With Triggers
11.Style Slider: Background, IsSnapToTickEnabled, AutoToolTipPlacement, TickFrequencyStyle Slider: Background, IsSnapToTickEnabled, AutoToolTipPlacement, TickFrequency
12.Normal: Origin at upper leftNormal: Origin at upper left
13.Stroke Start Line CapStroke Start Line Cap
14.Property TriggerProperty Trigger
15.Using a Style resourceUsing a Style resource
16.Sharing a StyleSharing a Style
17.Ignore an Implicit Style by setting Style to NullIgnore an Implicit Style by setting Style to Null
18.Set a Style ProgrammaticallySet a Style Programmatically
19.extends StyleSelector to create your own style selectorextends StyleSelector to create your own style selector
20.The default GroupStyle indents the items in a groupThe default GroupStyle indents the items in a group