やあみんな私はこのコンバーターを持っています:
public class BudgetIndicatorConverter :IValueConverter
{
public object Convert(object value, System.Type targetType,
object parameter, CultureInfo culture)
{
string Indicator = (string)value;
Brush _brush = new SolidColorBrush();
if (Indicator == "Green")
{
_brush = new SolidColorBrush(Colors.Green);
}
else if (Indicator == "Red")
{
_brush = new SolidColorBrush(Colors.Red);
}
return _brush;
}
public object ConvertBack(object value, System.Type targetType,
object parameter, CultureInfo culture)
{
return null;
}
}
Xaml でのバインディングは次のとおりです。
<TextBlock TextWrapping="Wrap" Margin="260,120,0,70" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{Binding Data[0].BudgetIndicator, Converter={StaticResource budgetcolor}}" FontFamily="{StaticResource PhoneFontFamilyBold}" Text="{Binding Data[0].TOTAL, Converter={StaticResource convertcurrency}}" TextAlignment="Right"/>
これを実行すると、テキストブロックに何も表示されなくなりましたか? 同じコントロールに 2 つのプロパティをバインドできるかどうかを知りたいです。テキストプロパティでわかるように、通貨をコンバーターにバインドすると機能しました。
「budgetindicator」へのバインディングが正しい値を送信できなかった可能性がありますか?
私がやりたいことは、通貨が表示されると、合計が緑または赤で表示され、予算内または予算を超えていることを意味しますか?
ヒントやリンクをいただければ幸いです
Visual Studio 2012/c#/silverlight 5/windows phone8 を使用
回答を完了するためにさらに必要な場合は、お知らせください。
前もって感謝します!