Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bring selected calendar date into view

Tags:

wpf

calendar

I select a date (not the current date) of a calendar (wpf) by code (C#). Now I want to bring this selected date into view. How can I solve that? All the time the current date is in view.

Any ideas to that? Thank you!

like image 938
manton Avatar asked Jan 23 '12 14:01

manton


1 Answers

You have to set the DisplayDate property as well.

var date = DateTime.Now.AddYears(-10);
cal.SelectedDate = date;
cal.DisplayDate = date;

enter image description here

You may also want to set the SelectionMode property to set the range of dates allowed (CalendarSelectionMode enumeration).

like image 116
Shimmy Weitzhandler Avatar answered Sep 24 '22 07:09

Shimmy Weitzhandler