disable mouse drag to select several slots on RadScheduleView

4 posts, 1 answers
  1. Brian
    Brian avatar
    3 posts
    Member since:
    May 2012

    Posted 24 May 2012 Link to this post

    Hello,

    I have a RadScheduleView that allows the end-user to select slots. I am capturing the selections via RadScheduleView.SelectedSlot, saving those to a collection and the collection is the bind source to RadScheduleView.SpecialSlotsSource so I can reflect back the state of selections. (please see…wantedclickbehavior.jpg)

     

    Desired Behavior: I only want the end-user to Left-Click on the RadScheduleView to make slot selections (even if the slots are consecutive).

     

    I need to disable “mouse drag to select several slots” (please see…unwanteddragbehavior.jpg).

     

    How can this be done?

     

    Additionally because of the desired behavior…
    How can I disable the keyboard modifiers: CTRL + Left-Click and SHIFT + Left-Click (so to prevent slot’s start – end exceeding the MinorTickLength)

     

    Thanks in advance…

  2. Answer
    Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 29 May 2012 Link to this post

    Hi Brian,

    We haven't tested such a scenario, but I would suggest to try to customize the SlotSelectionBehavior of the ScheduleView.  To do that you should inherit the SlotSelectionBehavior class and override its GetSelectionOverride method according to your requirements.

    Then attach the custom selection behavior like this:
    <telerik:RadScheduleView x:Name="scheduleView" >   
        <telerik:RadScheduleView.SlotSelectionBehavior>
            <local:CustomSlotSelectionBehavior />
        </telerik:RadScheduleView.SlotSelectionBehavior>
         ....
    </telerik:RadScheduleView>


    All the best,
    Boyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Tim
    Tim avatar
    1 posts
    Member since:
    Feb 2016

    Posted 18 Apr in reply to Boyan Link to this post

    I am having the same issue, I cannot figure out how to prevent slots from being dragged with the SlotSelectionBehaviour.
    I want the user to only be able to click a slot to select it and not drag it.

    This is the SlotSelectionBehaviour I am currently implementing

     public class CustomSlotSelectionBehavior : SlotSelectionBehavior
        {
            protected override Slot GetSelectionOverride(SlotSelectionState state, Slot currentSlot)
            {
                Slot newSlotSelection = new Slot(currentSlot.Start, currentSlot.End.AddMinutes(15));
                newSlotSelection.IsReadOnly = true;
                return base.GetSelectionOverride(state, newSlotSelection);
            }

    }

    Could you possible give me an example on how to accomplish this?

    Thanks,

    Tim

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Apr Link to this post

    Hi Tim,

    Please try the following approach and let us know whether it's suitable for you:

    public class CustomSlotSelectionBehavior : SlotSelectionBehavior
    {
        protected override Slot GetSelectionOverride(SlotSelectionState state, Slot currentSlot)
        {         
            if (state.IsContiguousSelection)
            {
                return state.Anchor;
            }
            return base.GetSelectionOverride(state, currentSlot);
        }
    }

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top