私がやっている :
<ListView Margin="34,42,42,25" Name="listView1">
<ListView.View>
<GridView>
<GridViewColumn Width="550" Header="Value" DisplayMemberBinding="{Binding Path=MyValue}"/>
</GridView>
</ListView.View>
<ListView.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Green"/>
</Style>
</ListView.Resources>
</ListView>
これが機能しているので、アイテムが緑色で表示されます。
今、私はこれでバインディング値を使用したいので、私はプロパティを持っています:
private Color _theColor;
public System.Windows.Media.Color TheColor
{
get { return _theColor; }
set
{
if (_theColor != value)
{
_theColor = value;
OnPropertyChanged("TheColor");
}
}
}
しかし、このバインディングを使用する場合:
<Setter Property="Foreground" Value="{Binding Path=TheColor}"/>
動いていない...
どうすれば修正できますか?
もちろん、私はTheColorをColors.Green
...に設定しています。
ご協力いただきありがとうございます