I found what I think might be a bug in the RadComboBox. The standard WPF combobox does not exhibit the problem.
I have a form on which I have a ListBox of 'PlateType' ViewModels. In my form VM I have a SelectedPlateType property bound to the SelectedItem of the ListBox.. This property contains an observable collection of PlateWellLayout view model objects that is bound to the RadComboBox. I also have several RadNumericUpDown fields of the second object bound to properties of the SelectedPlateWellLayout object. When a PlateType is selected in the List box, the contained SelectedPlateWellLayout is set in the SelectedPlateType setter in the form viewmodel, and the RadComboBox reflects this change.
The problem is that an exception is thrown when selecting a new PlateType from the list box if any of the numeric up down controls has had a value changed and has the focus (see below).
If I switch back to a normal WPF combo, the problem does not happen.
Here is the exception:
03/28/2011 23:30:27.486 FATAL System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Telerik.Windows.Controls.RadComboBoxAutomationPeer.RaiseSelectionEvents(SelectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\ComboBox\RadComboBoxAutomationPeer.cs:line 173
at Telerik.Windows.Controls.RadComboBox.OnSelectionChanged(SelectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\ComboBox\RadComboBox.cs:line 1891
at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems)
at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(Object item, Boolean assumeInItemsCollection)
at System.Windows.Controls.Primitives.Selector.OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.Data.BindingExpression.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\MVVMLight\GalaSoft.MvvmLight\ViewModelBase.cs:line 241
at CMViewModelBase.FirePropertyChangedEvent(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\ViewModelHelper.root\ViewModelHelper\CMViewModelBase.cs:line 92
at CMViewModelBase.OnPropertyChanged(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\ViewModelHelper.root\ViewModelHelper\CMViewModelBase.cs:line 79
at CM.Imager.ViewModel.PlateTypeEditorViewModel.set_SelectedPlateType(PlateTypeEntityVM value) in C:\Dev\Products\CrystalMation\Source\Application\ImagerViewModel\PlateTypeEditorViewModel.cs:line 101
Please let me know if there is a work-around - I would like to use the RadComboBox if possible.
Version of Telerik being used:
2010.3.1314.35
I have a form on which I have a ListBox of 'PlateType' ViewModels. In my form VM I have a SelectedPlateType property bound to the SelectedItem of the ListBox.. This property contains an observable collection of PlateWellLayout view model objects that is bound to the RadComboBox. I also have several RadNumericUpDown fields of the second object bound to properties of the SelectedPlateWellLayout object. When a PlateType is selected in the List box, the contained SelectedPlateWellLayout is set in the SelectedPlateType setter in the form viewmodel, and the RadComboBox reflects this change.
<
ListBox
x:Name
=
"listPlateTypes"
Margin
=
"0,4,0,0"
Background
=
"Gainsboro"
BorderBrush
=
"Gray"
BorderThickness
=
"1"
Padding
=
"5"
ItemsSource
=
"{Binding Path=PlateTypes}"
SelectedItem
=
"{Binding Path=SelectedPlateType, Mode=TwoWay}"
ItemTemplate
=
"{StaticResource PlateTypeItemTemplate}"
>
</
ListBox
>
<
tk:RadComboBox
Height
=
"30"
Width
=
"50"
ItemsSource
=
"{Binding Path=SelectedPlateType.PlateSubwells}"
ItemTemplate
=
"{StaticResource SubwellComboBoxTemplate}"
SelectionBoxTemplate
=
"{StaticResource SelectionBoxTemplate}"
SelectedItem
=
"{Binding Path=SelectedPlateWellLayout, Mode=TwoWay}"
/>
The problem is that an exception is thrown when selecting a new PlateType from the list box if any of the numeric up down controls has had a value changed and has the focus (see below).
If I switch back to a normal WPF combo, the problem does not happen.
Here is the exception:
03/28/2011 23:30:27.486 FATAL System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Telerik.Windows.Controls.RadComboBoxAutomationPeer.RaiseSelectionEvents(SelectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\ComboBox\RadComboBoxAutomationPeer.cs:line 173
at Telerik.Windows.Controls.RadComboBox.OnSelectionChanged(SelectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\ComboBox\RadComboBox.cs:line 1891
at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems)
at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(Object item, Boolean assumeInItemsCollection)
at System.Windows.Controls.Primitives.Selector.OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.Data.BindingExpression.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\MVVMLight\GalaSoft.MvvmLight\ViewModelBase.cs:line 241
at CMViewModelBase.FirePropertyChangedEvent(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\ViewModelHelper.root\ViewModelHelper\CMViewModelBase.cs:line 92
at CMViewModelBase.OnPropertyChanged(String propertyName) in C:\Dev\Products\CrystalMation\Source\CommonComponent\ViewModelHelper.root\ViewModelHelper\CMViewModelBase.cs:line 79
at CM.Imager.ViewModel.PlateTypeEditorViewModel.set_SelectedPlateType(PlateTypeEntityVM value) in C:\Dev\Products\CrystalMation\Source\Application\ImagerViewModel\PlateTypeEditorViewModel.cs:line 101
Please let me know if there is a work-around - I would like to use the RadComboBox if possible.
Version of Telerik being used:
2010.3.1314.35