Reputation: 40511
I have the following DatePicker
control in my project:
<DatePicker x:Name="startDate" SelectedDate="2013-04-03"></DatePicker>
QUESTION:
Is it possible to set the DatePicker.SelectedDate
using only XAML?
I know this can be achieved using code-behind.
Upvotes: 6
Views: 5658
Reputation: 26078
Try this...
Add this to xaml refs:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Then write this:
<DatePicker SelectedDate="{x:Static sys:DateTime.Now}"/>
Upvotes: 12