Calendar controls in Silverlight Forms

The Calendar control's Selected Date property displays the current date in the control. The DisplayDate property represents the date that will be displayed. If this is not set, then the Selected Date is displayed.

To access the Selected Date property in the Binding dialog box or the Expression Editor, clear the Hide Advanced Properties check box.

To bind to the Selected Date or to use it in an expression, bind directly to Selected Date; do not use the Value sub-property.

To work with subproperties of SelectedDate, you must modify the XAML (for bindings) or the MainPage.Proficy.cs (for expressions) files by hand. Editing the MainPage.Proficy.cs file must be done in Visual Studio.

Note: For more information, see Edit forms using Visual Studio 2010.

One method of binding to subproperties by modifying the XAML by hand is to bind to the desired subproperty under the Value subproperty in the designer, and then in Visual Studio, edit the affected file and remove the ".Value" and/or "__Value" from the binding. The binding has one ".Value" to remove. The expression has one ".Value" and one "__Value" to remove.

The following table lists the calendar control bindings that can be used and the bindings that will not work.

Bindings that workBindings that do not work
Calendar1.SelectedDateCalendar1_SelectedDate.Value
Calendar1_SelectedDate.DayOfYearCalendar1_SelectedDate.Value.DayOfYear

Expressions that workExpressions that do not work
{Calendar1__SelectedDate__Value__DayOfYear} {Calendar1__SelectedDate__Value}
{Calendar1__SelectedDate__DayOfYear} {Calendar1__SelectedDate}