2016-04-02 10 views
0

私の悪い英語のために申し訳ありません。オブジェクトのブール値に応じて、BorderBrushListBoxItemにバインドします。 私はIsForCopyIsCuttedブールの小道具を持っているDirectoryクラスを持っています。 したがって、IsForCopyが真の場合、BorderBrush =赤、IsCuttedが真の場合、BorderBrush =青です。これどうやってするの?c#wpf、ブール値に応じたプロパティのバインド値

ListBox.ItemContainerStyle> 
       <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}"> 
        <EventSetter Event="MouseDoubleClick" Handler="SecondListBoxItem_MouseDoubleClick"/> 
        <Setter Property="BorderBrush" Value="What do I should type there?"></Setter> 
       </Style> 
      </ListBox.ItemContainerStyle> 

答えて

0

IValueConverterを実装するクラスが必要です。 convertメソッドで、boolを任意の方法でブラシにマップする方法を指定することができます。すべてのバインディングにはIValueConverterを実装したこのクラスに設定できるコンバーター属性があります。

+0

Thx。それは動作します! –

関連する問題