C1DateTimePicker Control Help > C1DateTimePicker Task-Based Help > Setting the Minimum and Maximum Calendar Dates |
You can change the dates that calendar spans by setting the MinimumDate and MaximumDate properties in the designer, in XAML, and in code.
Note: Try to avoid avoid setting the C1DateTimePicker.MinDate and C1DateTimePicker.MaxDate properties in XAML as a string value. Parsing these values from strings is culture specific. If you set a value with your current culture and a user is using different culture, the user can get XamlParseException when loading your site. The best practice is to set these values from code or via data binding. |
In the Designer
Complete the following steps:
In XAML
Complete the following steps:
<my:C1DateTimePicker>
tag so that the markup resembles the following:
<my:C1DateTimePicker Height="26" Name="c1DateTimePicker1" MinDate="2008-01-01" MaxDate="2012-12-31" />
In Code
Complete the following:
Visual Basic |
Copy Code
|
---|---|
'Set the minimum date C1DateTimePicker1.MinDate = new DateTime(2008, 01, 01) 'Set the maximum date C1DateTimePicker1.MaxDate = new DateTime(2012, 12, 31) |
C# |
Copy Code
|
---|---|
//Set the minimum date c1DateTimePicker1.MinDate = new DateTime(2008, 01, 01); //Set the maximum date c1DateTimePicker1.MaxDate = new DateTime(2012, 12, 31); |