2009-05-21 3 views
0

アプリケーション幅をTextHeight(その他も同様)に設定したいと考えています。参照が見つからないようです。 IOW、さまざまなスタイルのStaticResourceにText Heightを設定します。xamlアプリケーションリソース値

答えて

1

私の脳はその質問を読んだ後少し痛いです。あたかもあなたが求めていることを真に理解しているかのように答えさせてください。

<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> 

予告ライン4、その後、新しいダブル(もタイプは、パラメータの型と一致しなければならないことに注意 - Iもともと試みたのsysを::明確化して

<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> 

のInt32ました興味深い無関係な例外をもたらした)。

+0

私の考えは、全員が終わりました。私は持っていたい... Value = "{StaticResource MyTextHeight}" />。だから私はMyTextHeightをアプリケーションリソースレベルで定義できるようにしたいと考えています。 ありがとうございました – Brad

+1

私の最も誠実なcontrafibularities!私の尊敬の小さなトークンとして、このチェックマークを取ってください。 – Brad

+0

おい、コーヒーを捨てる。その中毒性は大量にあります。 – Will

関連する問題