I have a listcontrol set to MultiExtended. When the user clicks on an item the SelectedIndexChanged event fires. However, if the user holds the shift key down and clicks another item, selecting all items between clicks, the event does not fire. I need to know that the user just added items to the SelectedItems list. What event can I use? Thanks
Later
Art
Later
Art
4 Answers, 1 is accepted
0
jtedrow
Top achievements
Rank 1
answered on 16 Mar 2011, 05:42 PM
The only icky way I have been able to overcome this issue would be to catch the KeyUp/MouseUp events on the box to check for selection change.
Is there a better way than this? I am having the same issue as Art, where the event will not fire for Shift+Click selections with MultiExtended enabled.
This becomes very slow however with large lists.
Is there a better way than this? I am having the same issue as Art, where the event will not fire for Shift+Click selections with MultiExtended enabled.
Private Sub lstIncludedFields_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lstIncludedFields.KeyUp 'Do Code here for selection changedEnd Sub
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Mar 2011, 06:05 PM
Hello Art,
Something like this is what you need I think. Please let me know if that helps, or if you need more information
Regards,
Richard
Something like this is what you need I think. Please let me know if that helps, or if you need more information
private void Form1_Load(object sender, EventArgs e){ foreach (RadListDataItem item in this.radListControl1.Items) { item.RadPropertyChanged += new Telerik.WinControls.RadPropertyChangedEventHandler(item_RadPropertyChanged); }}void item_RadPropertyChanged(object sender, Telerik.WinControls.RadPropertyChangedEventArgs e){ if (e.Property.Name == "Selected") { RadListDataItem item = (RadListDataItem)sender; MessageBox.Show(item.Text + " selected = " + item.Selected.ToString()); }}Regards,
Richard
0
Art
Top achievements
Rank 1
answered on 16 Mar 2011, 06:45 PM
Could you send that code in VB, although I have to admit I wil probably just use a VB ListBox, as it's selectionchanged event fires on multiselects.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Mar 2011, 10:00 PM
Hello Art,
here is the code in VB. Do let me know if that helps, or indeed if you have any difficulties.
All the best
Richard
here is the code in VB. Do let me know if that helps, or indeed if you have any difficulties.
Private Sub Form1_Load(sender As Object, e As EventArgs) handles Form1.Load For Each item As RadListDataItem In Me.radListControl1.Items AddHandler item.RadPropertyChanged, AddressOf item_RadPropertyChanged NextEnd Sub Private Sub item_RadPropertyChanged(sender As Object, e As Telerik.WinControls.RadPropertyChangedEventArgs) If e.Property.Name = "Selected" Then Dim item As RadListDataItem = DirectCast(sender, RadListDataItem) MessageBox.Show(item.Text & " selected = " & item.Selected.ToString()) End IfEnd SubAll the best
Richard