Completed
Last Updated: 21 May 2020 08:28 by ADMIN
Release LIB 2020.2.526 (05/26/2020)
Martin Ivanov
Created on: 21 Apr 2020 11:34
Category: MultiColumnComboBox
Type: Bug Report
0
MultiColumnComboBox: Selection is not cleared when the ItemsSource is replaced

If you select an item in RadMultiColumnComboBox and then replace the ItemsSource of the GridViewItemsSourceProvider, the selection in the autocompletebox part of the the control is not cleared. There are items that are still selected and are not presented in the ItemsSource.

To work this around, you can create a custom GridViewItemsSourceProvider and override its OnPropertyChanged method. When the ItemsSource is changed, you can reset the selection.

public class CustomGridViewItemsSourceProvider : GridViewItemsSourceProvider
{
	public RadMultiColumnComboBox Owner
	{
		get { return (RadMultiColumnComboBox)GetValue(OwnerProperty); }
		set { SetValue(OwnerProperty, value); }
	}
	
	public static readonly DependencyProperty OwnerProperty =
		DependencyProperty.Register(
			"Owner", 
			typeof(RadMultiColumnComboBox), 
			typeof(CustomGridViewItemsSourceProvider), 
			new PropertyMetadata(null));

	protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
	{
		base.OnPropertyChanged(e);
		if (e.Property.Name == "ItemsSource" && this.Owner != null)
		{
			this.Owner.SelectionBridge.ClearOwnerSelection();
		}
	}
}

 <telerik:RadMultiColumnComboBox.ItemsSourceProvider>
                <local:CustomGridViewItemsSourceProvider Owner="{Binding ElementName=mccb}" />
            </telerik:RadMultiColumnComboBox.ItemsSourceProvider>

0 comments