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

SelectedDate does not change in ViewModel

Hello, I have a SfSchedule control defined liket his in XAML:

<syncfusion:SfSchedule ScheduleView="MonthView" SelectedDate="{Binding SelectedDate, Mode = TwoWay}"/>

And the following ViewModel:

public class CalendarViewModel : ViewModelBase
    {
        private DateTime selectedDate;
        public DateTime SelectedDate
        {
            get
            {
                return selectedDate;
            }
            set
            {
                if (selectedDate == value)
                    return;
                selectedDate = value;
                OnPropertyChanged();
            }
        }
        public ICommand ViewCommand { get; private set; }
        public CalendarViewModel()
        {
            SelectedDate = DateTime.Today;
            ViewCommand = new Command(OpenDailyFoodListPage);
        }

        private async void OpenDailyFoodListPage()
        {
            var page = new DailyFoodListPage(SelectedDate);
            await navigationService.NavigateToAsync(page);
        }
    }

     When my page is opened the SfSchedule has the current date selected, which is correct, but upon selecting a different date the SelectedDate property in the ViewModel does not change at all. The setter never seems to get called at all upon selecting a different date in the SfSchedule. Am I doing something wrong or is it an underlying problem with the Binding?

1 Reply

VR Vigneshkumar Ramasamy Syncfusion Team November 1, 2018 06:41 AM UTC

Hi George,

Thanks for contacting Syncfusion support. 

We have checked the query with “ SelectedDate property in the ViewModel does not change at all” and working fine in Android and iOS platform and we are able to relproduce the issue in UWP alone. We have logged bug report for the same. A support incident to track the status of this defect has been created under your account. 

Please log on to our support website to check for further updates.


http://www.syncfusion.com/Account/Logon?ReturnUrl=%2fsupport%2fdirecttrac/  

Regards, 
Vigneshkumar R 


Loader.
Live Chat Icon For mobile
Up arrow icon