Background プロパティへの MultiBinding が機能しません。変換すると、背景は、MultiValueConverter で設定した色ではなく、システムのデフォルトの色に変わります。他のすべては適切に設定されています。MultiBinding to Background の何が問題になっていますか?
<Style.Triggers>
<DataTrigger Binding="{Binding Source={StaticResource triggerResource},
Path=MyIsSelected}"
Value="True">
<Setter Property="Background">
<Setter.Value>
<MultiBinding Converter="{StaticResource groupNameToBackgroundConv}">
<Binding Path="Name" />
<Binding Source="{StaticResource selectedGroupName}" Path="Name" />
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
そして、私の MultiValueConverter は
public class GroupNameToBackgroundConv : IMultiValueConverter
{
private const string DEFAULT_COLOR = "#B8CBE9";
private const string SELECTED_COLOR = "#FFFF00";
public object Convert(object[] values, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
string groupName = values[0] as string;
string selectedGroupName = values[1] as string;
if (groupName == null)
return DEFAULT_COLOR;
if (selectedGroupName == null)
return DEFAULT_COLOR;
if (groupName == selectedGroupName)
{
return SELECTED_COLOR;
}
else
{
return DEFAULT_COLOR;
}
} // ends method
public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
} // ends class