Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable past days in calender in WPF?

Tags:

wpf

i'm developing WPF application in that i'm trying to disable the past days in calender. any way is there to disable the past days.please let me know.

thanks

like image 698
CnuSeran Avatar asked Jul 01 '13 09:07

CnuSeran


1 Answers

You have to set the DisplayDateStart attribute with Today's date

<DatePicker Name="dt_StartDateFrom" DisplayDateStart="{x:Static sys:DateTime.Today}">
</DatePicker>

Make sure you have set the

xmlns:sys="clr-namespace:System;assembly=mscorlib"

in your <UserControl> tag to be able to use the sys: parameter

P.S. To Disable future dates, you can use DisplayDateEnd attribute

like image 109
sohaiby Avatar answered Sep 22 '22 04:09

sohaiby