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

disable mouse drag to select several slots on RadScheduleView

3 Answers 149 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 24 May 2012, 05:36 PM

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…

3 Answers, 1 is accepted

Sort by
0
Accepted
Boyan
Telerik team
answered on 29 May 2012, 11:59 AM
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 >>

0
Tim
Top achievements
Rank 1
answered on 18 Apr 2016, 10:31 AM

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

0
Yana
Telerik team
answered on 19 Apr 2016, 12:56 PM
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.
Tags
ScheduleView
Asked by
Brian
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Tim
Top achievements
Rank 1
Yana
Telerik team
Share this question
or