I have a DatePicker control bound to viewmodel.SelectedDate. Rather than using propfull I am using the CTK [ObservableProperty]. When I select a new date I want to call another function that gets a fresh dataset based on that new date. Is there another annotation for that?
/// Set by the Date Control on the form
[ObservableProperty]
//[AlsoCallThisFunction(DisplayBookings)]
public DateTime bookingDate;
///I want to call this for a fresh dataset
///after the bookingDate is set
void DisplayBookings()
{
GoToDatabaseAndGetNewRecordset(bookingDate);
}
Old way of doing it:
//private DateTime bookingDate;
//public DateTime BookingDate
//{
// get { return bookingDate; }
// set {
// bookingDate = value;
// DisplayBookings();
// }
//}
Fody.PropertyChanged
library you may useOn<PropertyName>Changed
methods likepublic DateTime BookingDate { get; set; } private void OnBookingDateChanged() { .. body or call of DisplayBookings ... }
and – Wide