Hello,
I observed a behavior of RadListControl which shows false results. I could reproduce it with this code:
If SelectionMode is None, all works fine. Changing to One and SortStyle to Ascending it shows 2 selected items, but only 1 is selected. If SortStyle is Descending and Test 1 and 2 preselected then it shows also 2 selected items with one selected in list. Similar results occures with SelectionMode MultiSimple and MultiExtended. With SortStyle Ascending only 1 item is select on view and list. On SortStyle Descending it changes to 3 items on view and list.
The work around of this bug?! is to set SortStyle after adding the items to Items list (in code, not during design time).
Regards from Leipzig
Holger Boskugel
I observed a behavior of RadListControl which shows false results. I could reproduce it with this code:
using System.Windows.Forms;using Telerik.WinControls.Enumerations;using Telerik.WinControls.UI;namespace TestListboxSortAnSelection{ public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radListControl1.SelectionMode = SelectionMode.MultiExtended; this.radListControl1.SortStyle = SortStyle.Ascending; this.radListControl1.Items.Add(new RadListDataItem("Test 1")); this.radListControl1.Items.Add(new RadListDataItem("Test 3") { Selected = true }); this.radListControl1.Items.Add(new RadListDataItem("Test 2") { Selected = true }); } private void radButton1_Click(object sender, System.EventArgs e) { MessageBox.Show(string.Concat("Selected items: ", this.radListControl1.SelectedItems.Count)); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.radListControl1 = new Telerik.WinControls.UI.RadListControl(); this.radButton1 = new Telerik.WinControls.UI.RadButton(); ((System.ComponentModel.ISupportInitialize)(this.radListControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).BeginInit(); this.SuspendLayout(); // // radListControl1 // this.radListControl1.CaseSensitiveSort = true; this.radListControl1.ItemHeight = 18; this.radListControl1.Location = new System.Drawing.Point(12, 12); this.radListControl1.Name = "radListControl1"; this.radListControl1.Size = new System.Drawing.Size(431, 312); this.radListControl1.TabIndex = 0; this.radListControl1.Text = "radListControl1"; // // radButton1 // this.radButton1.Location = new System.Drawing.Point(313, 330); this.radButton1.Name = "radButton1"; this.radButton1.Size = new System.Drawing.Size(130, 24); this.radButton1.TabIndex = 1; this.radButton1.Text = "radButton1"; this.radButton1.Click += new System.EventHandler(this.radButton1_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(455, 366); this.Controls.Add(this.radButton1); this.Controls.Add(this.radListControl1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.radListControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).EndInit(); this.ResumeLayout(false); } private Telerik.WinControls.UI.RadListControl radListControl1; private Telerik.WinControls.UI.RadButton radButton1; }}If SelectionMode is None, all works fine. Changing to One and SortStyle to Ascending it shows 2 selected items, but only 1 is selected. If SortStyle is Descending and Test 1 and 2 preselected then it shows also 2 selected items with one selected in list. Similar results occures with SelectionMode MultiSimple and MultiExtended. With SortStyle Ascending only 1 item is select on view and list. On SortStyle Descending it changes to 3 items on view and list.
The work around of this bug?! is to set SortStyle after adding the items to Items list (in code, not during design time).
Regards from Leipzig
Holger Boskugel