Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
ERROR: FieldLengthConverter.ConvertFrom (only on vista, XP == OK)
posted

Hello,

I have the following errors mentioned in the deboug-output window when i run my application:

Remark: I only get this error when i run on Vista Businnes (Dutch), and I don't get it when running same on Windows XP SP3 (Dutch)...

System.Windows.Data Error: 22 : Cannot convert '32' from type 'Double' to type 'Infragistics.Windows.DataPresenter.FieldLength' for 'en-US' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: FieldLengthConverter kan niet van System.Double worden geconverteerd.
   bij System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   bij System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   bij Infragistics.Windows.DataPresenter.FieldLengthConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   bij MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 6 : 'TargetDefaultValueConverter' converter failed to convert value '32' (type 'Double'); fallback value will be used, if available. BindingExpression:Path=ThumbnailSize; DataItem='Library_Geometry_ViewModel' (HashCode=30567910); target element is 'Field' (HashCode=6675738); target property is 'Width' (type 'Nullable`1') NotSupportedException:'System.NotSupportedException: FieldLengthConverter kan niet van System.Double worden geconverteerd.
   bij MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)
   bij MS.Internal.Data.TargetDefaultValueConverter.Convert(Object o, Type type, Object parameter, CultureInfo culture)
   bij System.Windows.Data.BindingExpression.ConvertHelper(IValueConverter converter, Object value, Type targetType, Object parameter, CultureInfo culture)'

I setup the binding in code (purpose is a dynamic column-with) depending on dynamic-value in model.

Remark: the solution itself works, but I was wondering why i get "errors" when running on Vista

   //Setup Binding: tmpBindingThumbnailSize
   Binding tmpBindingThumbnailSize = new Binding("ThumbnailSize");
   tmpBindingThumbnailSize.Source = this.XAML_iLibrary_Geometry_ViewModel;

   //Set binding: tmpBindingThumbnailSize
   BindingOperations.SetBinding(tmpFieldThumbnail, Infragistics.Windows.DataPresenter.Field.WidthProperty, tmpBindingThumbnailSize);

   Infragistics.Windows.DataPresenter.FieldSettings tmpFieldThumbnailSettings = null;
   tmpFieldThumbnailSettings = tmpFieldThumbnail.Settings;

   //Set binding: tmpBindingThumbnailSize

BindingOperations.SetBinding(tmpFieldThumbnailSettings, Infragistics.Windows.DataPresenter.FieldSettings.CellWidthProperty, tmpBindingThumbnailSize);

BindingOperations.SetBinding(tmpFieldThumbnailSettings, Infragistics.Windows.DataPresenter.FieldSettings.LabelWidthProperty, tmpBindingThumbnailSize);

 BindingOperations.SetBinding(tmpFieldThumbnailSettings, Infragistics.Windows.DataPresenter.FieldSettings.WidthProperty, tmpBindingThumbnailSize);