We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Selecting already selected day sets SelectedDate to DateTime.MinValue

A value of DateTime.MinValue is sent to SelectedDate

<input:SfCalendar
    Width="300" Height="300"
    Margin="10"
    FontSize="15"
    Style="{StaticResource CalendarStyle}"
    BorderBrush="Black" BorderThickness="1"
    SelectionMode="Single"
    ShowNavigationButton="True"
    DisplayDate="{Binding DisplayDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
    SelectedDate="{Binding SelectedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
    VisibleMaxDate="{Binding MaxFilterDate}"
    VisibleMinDate="{Binding MinFilterDate}">
    <interactivity:Interaction.Behaviors>
        <behaviors:CalendarMonthChangedBehaviour MonthChanged="{Binding ChangeMonthCommand}" />
    </interactivity:Interaction.Behaviors>
</input:SfCalendar>

4 Replies

VR Venkateshwaran Ramdoss Syncfusion Team March 14, 2016 11:50 AM UTC

Hi James,

Thank you for contacting Syncfusion Support.

We have analyzed the reported issue by creating a simple sample. But we were unable to reproduce the issue at our end. In this sample we have used SfCalendar and 'Change SelectedDate' button to set the same SelectedDate value at run time. Can you please check whether you are able to reproduce the reported issue with this sample?

Please download the sample from the below link

Sample: SfCalendarsample

Could you please provide more details about your query by modifying the sample and replication steps to reproduce the issue? It will help us to proceed further.

Regards,
Venkateshwaran V.R.


JN James Newton King March 14, 2016 11:56 PM UTC

Example attached.

As you can see selecting the already selected date sets SelectedDate to DateTime.Min

Attachment: SfCalendarsample_921c33f7.zip


VR Venkateshwaran Ramdoss Syncfusion Team March 15, 2016 11:17 AM UTC

Hi James,

We have confirmed the reported issue "Selecting already selected day sets SelectedDate to DateTime.MinValue" as a defect. We will include this fix in our Vol 1, 2016 Service pack 1 release which will be available in April, 2016.

Regards,
Venkateshwaran V.R.


RG Rajkumar Ganesamoorthy Syncfusion Team March 18, 2016 01:31 PM UTC

Hi James,

 

Please ignore the previous update.

 

We have modified your last updated sample to meet your requirement. In this sample we have changed type of SelectedDate in your view model as object.

 

The type of SelectedDate is object. So if we select the already selected date the SelectedDate property return the null(default value of object) value . But if we set SelectedDate as DateTime it will return its default value(DateTime.Min) . Due to this reason the SelectedDate changed to DateTime.Min. Please find the sample from the attached file.


Please let us know if the above sample meets your requirements or not.

 

Note: If you want to maintain SelectedDate as DateTime. Please skip the default value of DateTime  before setting the SelectedDate property as like in below code snippet.

 

set

            {

                if ((DateTime)value != DateTime.MinValue)

                {

                    if (!_monthArrowPressed && !value.Equals(_selectedDate))

                    {

                        Set(ref _selectedDate, value);

                        RaisePropertyChanged(() => DisplayFormattedDate);

                        CalendarIsOpen = false;

                        _dateSelectedCommand.ExecuteAsync((DateTime)_selectedDate);

                       

                    }

                }

              

 

Regards,

Rajkumar G

 

 


Attachment: SfCalendarsample_1bfb29ae.zip

Loader.
Up arrow icon