Xaml app resource value

I want to install a wide application like TextHeight (others) and I cannot find the link. IOW, set the height of the text to StaticResource in different styles, etc.

0


a source to share


1 answer


My brain hurts a little after reading this question. Let me answer as if I really understand what you are asking.

<Application x:Class="WpfApplication1.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>
        <Style TargetType="TextBox">
            <Setter Property="FontSize" Value="100"/>
        </Style>
    </Application.Resources>
</Application>

      




With clarification:

<Application x:Class="WpfApplication1.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    StartupUri="Window1.xaml">
    <Application.Resources>
        <sys:Double x:Key="MyTextHeight">32</sys:Double>
        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="{StaticResource MyTextHeight}"/>
        </Style>
    </Application.Resources>
</Application>

      

notice line 4, then a new Double (also note that the type must match the type of the parameter - I initially tried sys: Int32 which resulted in some interesting unrelated exceptions).

+1


a source







All Articles