<telerikInput:RadCalendar SelectedDateRange="{x:Bind DataRange,Mode=TwoWay}" DisplayMode="MonthView" SelectionMode="Multiple"/>
public sealed partial class MainPage : Page
{
private CalendarDateRange? dateRange = new CalendarDateRange(new DateTime(2019,3,1),new DateTime(2019,3,20));
public CalendarDateRange? DataRange
{
get => dateRange;
set
{
dateRange = value;
}
}
public MainPage()
{
this.InitializeComponent();
}
}
My question is how to do the selection operation on this control that will change the DataRange property value correctly? For now, the startdate and enddate always are the same value when I do the selection on the control.
6 Answers, 1 is accepted
I've just tested the provided snippet it works properly on my side. Please note that SelectedDateRange holds a reference to the first date range in the current selection. So, if you're added another selection range, this property will not be updated - in this case you would need to use SelectedDateRanges property. For more detailed information on this, refer to the Calendar: Selection topic in our documentation.
I've also attached my test project for a reference.
Let me know if you have any additional questions on this.
Regards,
Yana
Progress Telerik
I am sorry I wasn't able to reply earlier.
If the new DateRange contains only one date, that would be the expected behavior. Do you find any drawbacks with that approach?
Regards,
Yana
Progress Telerik
First, you'd need to implement INotifyPropertyChanged in order to update the view through two-way binding and then, the SelectedRange should be in the currently visible month.
I have attached the updated sample to show you how this would work.
I hope I was of help.
Regards,
Yana
Progress Telerik