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

Event for Slot Selection Change

6 Answers 167 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
TEC
Top achievements
Rank 2
TEC asked on 05 Aug 2011, 10:25 AM
Hi,

Is there an event where that is triggered when the Slot Selection Changes (just like AppointmentSelectionChanged)? Can you illustrate in code a way to hook on to the RadScheduleView Slot Selection Change.

Kind regards

6 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 08 Aug 2011, 01:10 PM
Hello,

RadScheduleView doesn't provide such an event. Could you please give us more details about your scenario and why you need this Slot selection changed event? Thanks

All the best,
Yana
the Telerik team

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

0
TEC
Top achievements
Rank 2
answered on 10 Aug 2011, 10:09 AM
Hi,

My scenario is that I want to propose a list of appointments to the user when a slot is selected? The proposal of appointments has to be calculated server side, so I need a hook (event) for the slot selection change to send a command to the server. I hope this is clear enough. 

Kind regards.
0
Yana
Telerik team
answered on 11 Aug 2011, 12:44 PM
Hello Tec,

You can bind SelectedSlot property of the ScheduleView to a property in your ViewModel like this:

<telerik:RadScheduleView x:Name="schedule" SelectedSlot="{Binding SelectedSlot, Mode=TwoWay}">
    <telerik:RadScheduleView.ViewDefinitions>
        <telerik:MonthViewDefinition />
    </telerik:RadScheduleView.ViewDefinitions>
...
</telerik:RadScheduleView>

and the ViewModel:

public class MyViewModel : ViewModelBase
{
    private Slot selectedSlot;
    public Slot SelectedSlot
    {
        set
        {
            if (selectedSlot != value)
            {
                selectedSlot = value;
                this.OnPropertyChanged("SelectedSlot");
            }
        }
        get
        {
            return selectedSlot;
        }
    }
}

Try it and let us know how it goes.

Regards,
Yana
the Telerik team

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

0
TEC
Top achievements
Rank 2
answered on 19 Aug 2011, 11:04 PM
Hi,

I did not do it exactly as you suggested, but I did get it working for me with a binding on the "SelectedSlot" property. As follows:
......
   Binding bSelectedSlot = new Binding();
			bSelectedSlot.Source = myRadScheduleView;
			bSelectedSlot.Mode = BindingMode.TwoWay;
			bSelectedSlot.Path = new PropertyPath("SelectedSlot");
			bSelectedSlot.Converter = new SlotSelectionConverter(SlotSelectionChanged);
   myRadScheduleView.SetBinding(RadScheduleView.SelectedSlotProperty, bSelectedSlot);
.....
  private void SlotSelectionChanged(Slot slot)
		{
			......
		}


    public delegate void ProcessSlotDelegate(Slot slot);

    public class SlotSelectionConverter : IValueConverter
    {
        private ProcessSlotDelegate slotSelectionChanged;
 
        public SlotSelectionConverter(ProcessSlotDelegate slotSelectionChanged)
        {
            this.slotSelectionChanged = slotSelectionChanged;
        }
 
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ((slotSelectionChanged != null) && (value is Slot))
                slotSelectionChanged(value as Slot);
            return value;
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }

Thanks for the help.

Kind regards
0
Eric
Top achievements
Rank 1
answered on 23 Aug 2011, 11:28 PM
Sorry...didn't scroll down far enough.
0
Ad
Top achievements
Rank 2
answered on 05 Aug 2015, 02:44 PM

The first suggestion from Yana works great for me out-of-the-box.

Thanks anyway.

Tags
ScheduleView
Asked by
TEC
Top achievements
Rank 2
Answers by
Yana
Telerik team
TEC
Top achievements
Rank 2
Eric
Top achievements
Rank 1
Ad
Top achievements
Rank 2
Share this question
or