This is a migrated thread and some comments may be shown as answers.

Determine whether SelectionChanged event was triggered by a user

1 Answer 692 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 15 Jan 2019, 10:33 AM

Is there a way to find out if the RadListBox.SelectionChanged event was triggered by user input (mouse click, touch, tabbing, keyboard input...) vs programmatically (by setting datacontext, binding, or  setting RadListBox.SelectedItem in code behind)?

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 15 Jan 2019, 01:13 PM
Hello Tom,

A possible approach that comes to mind is handling the PreviewKeyDown, PreviewMouseLeftButtonDown, PreviewTouchDown events and set a boolean variable which you can check in the SelectionChanged event. That said, you can also set a boolean variable when you set the SelectedItem in code and check that in the SelectionChanged event. Please, give these approaches a try and let me know how it goes.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ListBox
Asked by
Tom
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or