【发布时间】:2011-07-09 20:42:04
【问题描述】:
当(未)选择 ListViewItem 时,如何在 WPF 中启用/禁用带有 DataBinding 的 TextBox?
我创建了一个转换器类:
public class BoolConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new Exception("The method or operation is not implemented.");
}
}
并将属性添加到文本框:
IsEnabled="{Binding SelectedItem, ElementName=listViewCards, Converter={StaticResource BoolConvert}}"
但我有一个 XamlParseException 因为他找不到类:-(
【问题讨论】:
标签: wpf data-binding listview binding textbox