Is it possible to bind to the collection of selected dates / how would I use the selected dates in my view model?
thanks
David
2 Answers, 1 is accepted
0
Vladi
Telerik team
answered on 16 Oct 2012, 06:28 AM
Hello David,
In the current version of RadCalendar it is not possible bind the SelectedDates to a Collection of DateTime objects. The SelectedDates property has only a Get method in order to get the selected dates in the control but it cannot be used to bind a collection to the control.
If you have any other questions do not hesitate to contact us again.
I have been playing with a workaround for this limitation.
I use a trigger on SelectionChanged:
<inter:Interaction.Triggers>
<inter:EventTrigger EventName="SelectionChanged">
<galaSoftMvvmLightCommand:EventToCommand PassEventArgsToCommand="True" Command="{Binding ChangeCalendarSelectionCommand}" CommandParameter="{Binding SelectedDates, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadCalendar}}}" />
</inter:EventTrigger>
</inter:Interaction.Triggers>
which binds to a Relaycommand, and passes in an ObservableCollection<DateTime> as command parameters. Problem to overcome then is that it fires multiple times so shouldn't be used for long running task.