2011-07-04 5 views
0

私は<TextBlock Text="{Binding TexT}" Style="{StaticResource PhoneTextNormalStyle}"/> も持っています(bool Read_State) Read_State == falseの場合、TextBlockの色を青に変更できますか?私はPhoneTextStyleにごPhoneTextNormalStyleの名前を変更し、存在する場合、両方(またはすべての状態を扱うでしょう、そのスタイルにトリガーを追加します値に応じてxxxx要素をバインドする

<TextBlock ...> 
    <TextBlock.Style> 
    <Style TargetType="TextBlock"> 
     <Style.Triggers> 
     <DataTrigger Binding="{Binding Path=Read_State}" Value="False"> 
      <Setter Property="Background" Value="Blue" /> 
     </DataTrigger> 
     </Style.Triggers> 
    </Style> 
    </TextBlock.Style> 
</TextBlock> 

答えて

0

はあなたのTextBlockのスタイルにDataTriggerを使用する必要がありますより多くの条件)。

+0

スタイルクラスにはTriggersプロパティがありません.Windows Phone SDK(ベータ2)を使用しています – SevenDays

+0

謝罪、私はwp7タグに気付きませんでした。これは関連する質問で、おそらく受け入れられた答えがあなたを助けます:http://stackoverflow.com/questions/5647557/style-triggers-in-windows-phone-7 – sellmeadog

関連する問題