WPF中ListBox绑定了数据源,如何写转换器
发布网友
发布时间:2022-04-21 19:37
我来回答
共1个回答
热心网友
时间:2023-10-18 13:25
使用一个转换器即可
完整代码:http://download.csdn.net/detail/lk13962517093/8459921
转换器代码如下:
public class MyConverter : IValueConverter
{
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
{
bool? f = (bool?)value;
return f == false ? System.Windows.FlowDirection.RightToLeft : System.Windows.FlowDirection.LeftToRight;
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}