0

列类型是 tinyint,我需要转换为字符串,我Converter用于 xaml

Text="{Binding confirmed,Converter={StaticResource UserConverter}}"

所以

class UserConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                var listOfInt = value as UInt32[];
                return ""+listOfInt+"";
            }
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }
    }

但它错了,请帮我写代码:)

4

1 回答 1

1

你遇到了什么错误?

AtinyInt应该映射到 a byte,而不是 a UInt32[]

如果您的结果是 tinyInt 的数组,请尝试转换为byte[]

于 2012-07-20T12:29:48.960 回答