Determine whether SelectionChanged event was triggered by a user

2 posts, 0 answers
  1. Tom
    Tom avatar
    4 posts
    Member since:
    Nov 2018

    Posted 15 Jan Link to this post

    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)?

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    462 posts

    Posted 15 Jan Link to this post

    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.
Back to Top