I want to style the DateTimePicker from the Extended WPF Toolkit a bit differntly, especially the Calendar control.
<ControlTemplate x:Key="DatePickerTemplate" TargetType="{x:Type xctk:DateTimePicker}"> ... <Calendar x:Name="PART_Calendar" Template="{StaticResource CalendarTemplate}" BorderThickness="0" DisplayDate="2014-05-14"/>" ... </ControlTemplate> What is necessary so that I am allowed to reference the Control template below in the code above (both are in the same file)?
<ControlTemplate x:Key="CalendarTemplate" TargetType="Calendar"> <StackPanel x:Name="Root" HorizontalAlignment="Center"> <CalendarItem x:Name="CalendarItem" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Template="{StaticResource CalendarItemTemplate}"/> </StackPanel> </ControlTemplate> At present VS complains: The ressource "CalendarTemplate" could not be resolved.
Update: After changing the order of definitions, so first define <ControlTemplate x:Key="CalendarTemplate" TargetType="Calendar">... then the ControlTemplate that uses CalendarTemplate it works, remembers me of c++, but now I get the following Exception if I try to open the calendarcontrol:
Add value to dictionary of type 'System.Windows.ResourceDictionary' threw an exception.