Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to catch the selected date changed event in calendar?

Tags:

c#

wpf

calendar

I need to fire the date selected by an user for perform a research in a database. The caller class isn't the MainWindow class but rather an external class called Fixtures, and read objects GUI call the manufacturer via a variable. For example, in this case to access the calendar execute:

MainWindow.AppWindow.Calendar;

How can I see if a date has been selected by a user?

like image 665
Harold Finch Avatar asked Dec 03 '25 11:12

Harold Finch


1 Answers

If you want to do something when selected date changes, the Calendar control has a SelectedDatesChanged event. Add an event handler method for this event.

XAML:

<Calendar SelectedDatesChanged="Calendar_OnSelectedDatesChanged"/>

Code behind:

private void Calendar_OnSelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{
}

It sounds like your question might be around object scope in C#. Needs further explanation

like image 153
Glen Thomas Avatar answered Dec 05 '25 01:12

Glen Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!