How can I intercept a "SelectionChanging" event?

5 posts, 1 answers
  1. David
    David avatar
    57 posts
    Member since:
    Apr 2011

    Posted 27 Jul 2011 Link to this post

    Hi,

    I'm wondering whether I can intercept a "SelectionChanging" event. While there is a "SelectionChanged" event exposed, I would like to implement my own custom logic to manipulate SelectionStart and SelectionEnd when the user changes the selection before the changes are committed. The logic I would like to implement is for the SelectionStart and SelectionEnd to snap to the nearest hour if the selection period is less than a day, or snap to the nearest day if the selection period is over a day (This logic is more complex than what the IsSnapToIntervalEnabled property provides). While I can change the SelectionStart and SelectionEnd in the SelectedChanged event, this causes the SelectedChanged event to trigger again when I change one of these values.

    Kind regards,
    Dave.
  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 29 Jul 2011 Link to this post

    Hello David,
    Currently, the RadTimeBar control does not offer the functionality you need. I will forward your request to our developers and we will consider your suggestion.

    Greetings,
    Tsvetie
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Douwe
    Douwe avatar
    10 posts
    Member since:
    Oct 2015

    Posted 26 Apr in reply to Tsvetie Link to this post

    Hello,

    Is there any news related to this topic? We are also using the IsSnapToIntervalEnabled setting but the issue is that when there are incomplete intervals (e.g. hours) at the beginning and end of the complete time interval (while viewing day intervals) it is not possible to select these hours (because the snapping is on day intervals).

    Best regards,

    Douwe

  5. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 29 Apr Link to this post

    Hello,

    No such behavior is not yet implemented. However, to prevent the default selection interaction you can handle the MouseMove event of the timebar control. Then you can implement custom behavior that changes the SelectionStart and SelectionEnd based on your conditions. You can use the ConvertPointToDateTime() method of the timebar to get the mouse position as a date in the timeline.
    void timeBar_PreviewMouseMove(object sender, MouseEventArgs e)
    {
        // change the selection range
        e.Handled = true;  
    }

    Regards,
    Martin
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Douwe
    Douwe avatar
    10 posts
    Member since:
    Oct 2015

    Posted 25 May in reply to Martin Link to this post

    Dear Martin,

    Thank you for the tip, I will look into this to see if I can use this to implement the desired behavior.

    Kind regards,

    Douwe

Back to Top
UI for WPF is Visual Studio 2017 Ready