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.
Unfortunately, activation email could not send to your email. Please try again.

Selecting already selected day sets SelectedDate to DateTime.MinValue

Thread ID:

Created:

Updated:

Platform:

Replies:

123388 Mar 13,2016 08:10 PM Mar 18,2016 09:31 AM UWP 4
loading
Tags: SfCalendar
James Newton King
Asked On March 13, 2016 08:10 PM

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>

Venkateshwaran Ramdoss [Syncfusion]
Replied On March 14, 2016 07:50 AM

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.

James Newton King
Replied On March 14, 2016 07:56 PM

Example attached.

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

Attachment: SfCalendarsample_921c33f7.zip

Venkateshwaran Ramdoss [Syncfusion]
Replied On March 15, 2016 07:17 AM

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.

Rajkumar Ganesamoorthy [Syncfusion]
Replied On March 18, 2016 09:31 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;