To reproduce: private void RadListControl1_SelectedItemsChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) { string s = $"Selected Count = {radListControl1.SelectedItems.Count}, SelectedItems[0].Selected = {radListControl1.SelectedItems[0].Selected}, Items[0].Selected = {radListControl1.Items[0].Selected}"; MessageBox.Show(s); } private void radButton1_Click(object sender, EventArgs e) { string[] Names = { "Microsoft"/*, "Apple", "Google"*/ }; radListControl1.Items.AddRange(Names); } Workaround: Use SelectedIndexChanged event.
To reproduce: List<string> source; public RadForm1() { InitializeComponent(); radListControl1.Items.AddRange(source); }
To reproduce: multiple borders will be shown when you drag and drop multiple items in RadListControl. Please run the attached sample project and follow the steps from the attached gif file. Workaround: this.radListControl1.SelectionMode = SelectionMode.One;
To reproduce: - Add some items. - Select an item and then select it again - The SelectedItemsChanged is fired 3 times and it should fire only when the item is selected for the first time. Workaround: Use SelectedIndexChanged instead.
How to reproduce: check the attached file Workaround: create a custom drag-drop service public class CustomListControlDragDropService : ListControlDragDropService { private RadListDataItem draggedItem; public CustomListControlDragDropService(RadListElement owner) : base(owner) { } protected override void PerformStart() { base.PerformStart(); RadListVisualItem draggedVisualItem = this.Context as RadListVisualItem; if (draggedVisualItem != null) { this.draggedItem = draggedVisualItem.Data; } } protected override void PerformStop() { base.PerformStop(); this.DisposeHint(); this.draggedItem = null; } protected override void OnPreviewDragDropCore(RadListElement targetList, RadListVisualItem targetElement) { int index = targetList.Items.Count - 1; if (targetElement != null) { index = targetList.Items.IndexOf(targetElement.Data); } if (this.draggedItem.Owner != targetList) { index++; } RadListElement dragedListView = this.draggedItem.Owner; IList<RadListDataItem> itemsToMove = new List<RadListDataItem>(dragedListView.SelectedItems.Count); foreach (RadListDataItem item in dragedListView.SelectedItems) { itemsToMove.Add(item); } dragedListView.BeginUpdate(); foreach (RadListDataItem item in itemsToMove) { item.Selected = item.Active = false; dragedListView.Items.Remove(item); } dragedListView.EndUpdate(); targetList.BeginUpdate(); foreach (RadListDataItem item in itemsToMove) { if (index > targetList.Items.Count) { targetList.Items.Add(item); } else { targetList.Items.Insert(index, item); } item.Selected = item.Active = true; index++; } targetList.EndUpdate(); } }
To reproduce: - Add 500 items. Then set the following:: radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.DefaultItemsCountInDropDown = 500; Workaround: radDropDownList1.DropDownListElement.AutoCompleteSuggest = new MySuggestHelper(this.radDropDownList1.DropDownListElement); class MySuggestHelper : AutoCompleteSuggestHelper { public MySuggestHelper(RadDropDownListElement owner ) : base (owner) { } public override void ShowDropDownList() { base.ShowDropDownList(); this.DropDownList.Popup.UpdateLocation(); } }
To reproduce: run the atatched project, you will notice that the last item is not visible. Workaround: add the items in the form's constructor.
Workaround: this.radListControl1.VisualItemFormatting += RadListControl1_VisualItemFormatting; private void RadListControl1_VisualItemFormatting(object sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args) { DescriptionTextListVisualItem item = args.VisualItem as DescriptionTextListVisualItem; if (item == null) { return; } item.MainContent.EnableBorderHighlight = false; item.MainContent.EnableHighlight = false; item.DescriptionContent.EnableBorderHighlight = false; item.DescriptionContent.EnableHighlight = false; foreach (var c in item.Children) { this.SetNMouseProperties(c); } } private void SetNMouseProperties(RadElement element) { element.ShouldHandleMouseInput = false; foreach (var item in element.Children) { this.SetNMouseProperties(item); } }
Workaround: this.radListControl1.ItemHeight = 40;
How to reproduce: var descriptionItem = new DescriptionTextListDataItem() { Text = "Chicken wings", DescriptionFont = new Font("Arial", 20, FontStyle.Bold), DescriptionText = "some description", }; this.radListControl1.Items.Add(descriptionItem); Workaround: handle the VisualItemFormatting event and set the font to the DescriptionContent element https://docs.telerik.com/devtools/winforms/dropdown-listcontrol-and-checkeddropdownlist/listcontrol/customizing-appearance/formatting-items
To reproduce: 1. Add a RadListControl and add several items at design time. 2. Open the smart tag and select Edit Items. Then set the Selected property to true for one of the items. You will notice that the item is selected. However, when you click OK and close the RadListDataItem Collection Editor the selection is not preserved. Workaround: set the Selected property at run time.
To reproduce: - Add data items which have category, and set the SelectionMode to MultiExtended - Then use the following code and select items from different category: private void RadListControl1_SelectedItemsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems == null) { return; } var newCategory = (((RadListDataItem) e.NewItems[0]).DataBoundItem as MyData).Category; var prevCategory = (radListControl1.SelectedItem.DataBoundItem as MyData).Category; if (newCategory != prevCategory && radListControl1.SelectedItems.Count > 1) { radListControl1.SuspendSelectionEvents = true; //exception var items = radListControl1.SelectedItems.ToList(); for (int i = 0; i < items.Count - 1; i++) { items[i].Selected = false; } //after this the selection is broken and the user cannot select an item //radListControl1.SelectedItem = null; radListControl1.SuspendSelectionEvents = false; } }
To reproduce: 1. Create a new WinForms project 2. Drag a RadListControl on the form 3.Start the application/project 3. Focus the Control and press Pos 1 / Home or End. >> The Application crashes due to a Telerik Control internal NullReference Exception Workaround: public class CustomListControl : RadListControl { public override string ThemeClassName { get { return typeof(RadListControl).FullName; } } protected override void OnKeyDown(KeyEventArgs e) { if ((e.KeyCode == Keys.Home || e.KeyCode == Keys.End) && this.Items.Count == 0) { return; } base.OnKeyDown(e); } }
To reproduce: 1. Use the following code snippet: public Form1() { InitializeComponent(); for (var x = 0; x < 1000; x++) { radListControl1.Items.Add(string.Format("i{0}", x)); } } 2. Select the first item and scroll down by using the mouse wheel. 3. When you click over a new item to select it, the vertical scroll-bar jumps to the top Workaround: handle MouseDown event and change the active item private void radListControl1_MouseDown(object sender, MouseEventArgs e) { RadListVisualItem el = this.radListControl1.ListElement.ElementTree.GetElementAtPoint(e.Location) as RadListVisualItem; if (el!=null) { this.radListControl1.ActiveItem = el.Data; } }
To reproduce: protected override void OnLoad(EventArgs e) { base.OnLoad(e); AddListControl(); radListControl1.AutoSizeItems = true; radListControl1.Font = new Font("Arial", 22); } Workaround: After the font is set, set the AutoSizeItems to false and then back to true
Workaround, set the custom comparer in the SortStyleChanged event: void radListControl1_SortStyleChanged(object sender, SortStyleChangedEventArgs args) { radListControl1.ListElement.ItemsSortComparer = new MyComparer(); } class MyComparer : IComparer<RadListDataItem> { public int Compare(RadListDataItem x, RadListDataItem y) { return ((Student)x.DataBoundItem).Id.CompareTo(((Student)y.DataBoundItem).Id); } } private void radButton1_Click(object sender, EventArgs e) { radListControl1.SortStyle = SortStyle.Ascending; }
When I click on the scrollbar of a radlistcontrol to go down. The doubleclick event is fired but I don't think it should be fired.
DECLINED: The Rebind method works as expected. This case was logged because ScrollToItem is not working after Rebind and this is due to the fact that our layout system is not synchronous. In order to be able to ScrollToItem, you need to call UpdateLayout first: RadListControl1.SelectedItem = itemToSelect Me.RadListControl1.ListElement.UpdateLayout() RadListControl1.ScrollToItem(itemToSelect)
To reproduce: - add 10 items to the control named "Listitem 1" .... "Listitem 10" - press "L" to navigate between the items => the first is selected, then the third, the fifth, so on, while they should be selected in the order they appear and once the end is reached it should start over.
When AutoSizeItems and TextWrap are enabled, the text of the items that are larger than the visible area of the control is truncated and items size is limited to the size of the visible area.