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
45
Unable to cast object of type System.Windows.Data.BindingExpression to type Infragistics.Windows.Editors.ComboBoxItemsProvider
posted

I keep recieving the Unable to cast object of type 'System.Windows.Data.BindingExpression' to type 'Infragistics.Windows.Editors.ComboBoxItemsProvider' error. The only way I can remove the error is to remove the ComboEditorTool,. 

<ribbon:XamRibbon.QuickAccessToolbar>
<
ribbon:QuickAccessToolbar Background="Transparent">
<
ribbon:QatPlaceholderTool TargetId="propertyLabel"/>
<
ribbon:QatPlaceholderTool TargetId="propertySelector"/>
</
ribbon:QuickAccessToolbar>
</
ribbon:XamRibbon.QuickAccessToolbar>
<
ribbon:XamRibbon.ToolsNotInRibbon>
<
ribbon:ButtonTool IsEnabled="False" BorderBrush="Transparent" BorderThickness="0" Content="Property Selector" Id="propertyLabel"/>
<
ribbon:ComboEditorTool Id="propertySelector" x:Name="propertySelector" IsEditable="True"
DropDownResizeMode="VerticalOnly" EditAreaWidth="250"/>
</
ribbon:XamRibbon.ToolsNotInRibbon>

List<Entity> entities = new List<Entity>();
entities = GetAllEntities();
entities.Sort(
delegate(Entity e1, Entity e2) { return e1.EntityName.CompareTo(e2.EntityName); });
this.formsDock.Children.Clear();

if (entities.Count <= 0)
{
PropertyFormControl form = new PropertyFormControl();
this.formsDock.Children.Add(form);
return;
}

entities.Insert(0, new Entity(-1, "", " -- All Locations --", "", ""));
ComboBoxItemsProvider itemsProvider = new ComboBoxItemsProvider();
itemsProvider.ItemsSource = entities;
itemsProvider.DisplayMemberPath =
"EntityName";
itemsProvider.ValuePath =
"EntityId";
propertySelector.SelectedItemChanged +=
new RoutedPropertyChangedEventHandler<object>(propertySelector_SelectedItemChanged);
propertySelector.ItemsProvider = itemsProvider;
propertySelector.SelectedIndex = 0;

  • 45
    posted

    If anyone else experiences this problem, be sure you have installed .NET Framework 3.0 SP1. I didn't realize that the new computer I was provided didn't already have it installed.

  • 5
    posted

    Hi, jmantheiy

    One of our user is experiencing very similar problem(exception attached).  This issue is very hard to reproduce.  I cannot find too much useful information in the internet until i found your post which is pretty close to the problem at our hand now.

      I am very interested to know

    1) What's the nature of your bug?  Is it .NET framework related or Infragistics related. 

    2) What's the solution?

     I am very appreicated to have any feedback you can give.

     Thanks a lot

     Ming

     

    --------------------------------------------------

    Unhandled exception occured, Exception='System.InvalidCastException: Unable to cast object of type 'System.Windows.Data.BindingExpression' to type 'System.IConvertible'.   at System.Convert.ToBoolean(Object value, IFormatProvider provider)   at MorganStanley.IED.Passport.Windows.IntegerToVisibilityConverter.Convert(Object value_, Type targetType_, Object parameter_, CultureInfo culture_) in c:\dev\buildshelf\ied\ied\Passport\2008.3-prod\src\assemblies\IED.PassportWindows\IntegerToVisibilityConverter.cs:line 56   at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)   at System.Windows.Data.BindingExpression.Activate(Object item)   at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)   at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)   at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)   at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)   at System.Windows.FrameworkElement.SetBinding(DependencyProperty dp, BindingBase binding)