This is a migrated thread and some comments may be shown as answers.

RadDatePicker Update issue

1 Answer 240 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 25 Apr 2013, 02:09 PM
There seems to be a bug with the raddatepicker, when a bound property is updated, the value displayed is not updated to the correct value. I'm trying to prevent the user from entering a future date, and I can step through the property and field is setting it correctly, also, after the change is raised, it's returning the new date set in code behind, but the UI still displays the typed in date.  This code works as expected with the built in WPF datepicker. (ie the UI updates to the correct date (DateTime.Now) if a future date is entered).

<telerik:RadDatePicker SelectedDate="{Binding Path=ApplicationDate, Mode=TwoWay}" DisplayDateEnd="{x:Static sys:DateTime.Now}"/>


The property for the bound value is defined as
public DateTime? ApplicationDate
        {
            get { return Loan.ApplicationDt; }
            set
            {
                if (value > DateTime.Now.Date)
                    Loan.ApplicationDt = DateTime.Now.Date;
                else
                    Loan.ApplicationDt = value;
                RaisePropertyChanged("ApplicationDate");
            }
        }

1 Answer, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 25 Apr 2013, 11:30 PM
I found the answer, the SelectedDate property doesn't work, but using SelectedValue as the binding instead does the trick...ie changed the xaml to

<telerik:RadDatePicker SelectedValue="{Binding Path=ApplicationDate, Mode=TwoWay}" DisplayDateEnd="{x:Static sys:DateTime.Now}"/>

Tags
DatePicker
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Share this question
or