Completed
Last Updated: 12 Feb 2020 12:06 by ADMIN
Release R1 2020 SP1
Wardeaux
Created on: 10 Feb 2020 11:05
Category: FileDialogs
Type: Bug Report
1
RadOpenFileDialog: when removed from the auto complete box collection the deselected items still remain selected in the list view

Steps to reproduce:

1. Open RadOpenFileDialog.

2. Select items.

3. Remove an item from the "File name" autocomplete box.

To workaround:

RadAutoCompleteBox acb = openFileDialog.OpenFileDialogForm.Controls.Find("selectedFilesAutoCompleteBox", true)[0] as RadAutoCompleteBox;
acb.Items.CollectionChanged += this.Items_CollectionChanged;
private void Items_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
    {
        ExplorerControl explorerControl = this.openFileDialog.OpenFileDialogForm.ExplorerControl;

        List<ListViewDataItem> selecteditems = explorerControl.FileBrowserListView.SelectedItems.ToList();
        foreach (RadTokenizedTextItem varItem in e.NewItems)
        {
            string strText = varItem.Text.Trim();

            foreach (ListViewDataItem item in explorerControl.FileBrowserListView.SelectedItems)
            {
                if (item.Text == strText)
                {
                    selecteditems.Remove(item);
                }
            }
        }

        explorerControl.FileBrowserListView.SelectedItems.Clear();
        explorerControl.FileBrowserListView.Select(selecteditems.ToArray());
    }
}

The achieved result is demonstrated in the attached gif file.

Attached Files:
0 comments