我無法使用它適用於Windows Phone 7.0的IValueConverter。 下面是綁定的元素我的XAML代碼:Windows Phone IValueConverter問題
<TextBlock Text="{Binding Verified, Converter={StaticResource TextConverter}}" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="14" />
這裏是XAML文件的代碼隱藏。
public class TextConverter : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ((bool)value == false)
{
return ("Verified is False!");
}
if ((bool)value == true)
{
return ("Verified is True!");
}
else
{
return ("Error!");
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
它認爲這是正確的,但它似乎是一個應用程序甚至無法找到TextConverter類,我有你的地方申報呢?當我運行這個應用程序時,我得到一個Application_UnhandledException
。我希望有人能幫助我,謝謝。
你應該給誰回答正確答案的第一人當它的正確 – MyKuLLSKI 2012-02-15 22:09:08
那麼我對答案的接受是基於哪個答案最好解釋如何解決問題,它可能會傷害你,但我雖然另一個更好地解釋。 – parek 2012-02-22 13:06:00