вы должны выставить свойство зависимости DateTime для элемента управления, сделав так:
public DateTime Day
{
get { return (DateTime)GetValue(DayProperty); }
set { SetValue(DayProperty, value); }
}
// Using a DependencyProperty as the backing store for Day. This enables animation, styling, binding, etc...
public static readonly DependencyProperty DayProperty =
DependencyProperty.Register("Day", typeof(DateTime), typeof(DayOfWeek), new UIPropertyMetadata(DateTime.MinValue));
если вы хотите, чтобы это было сгенерировано автоматически, вам нужно иметь ItemsControl, который содержит ваш dayControl, например:
<ItemsControl x:Name="DaysItemsControl">
<ItemsControl.ItemTemplate>
<DataTemplate>
<custom:DayDisplay Day="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
, а затем DataBind его из кода:
DateTime[] week = new DateTime[] { new DateTime(2000,1,1), new DateTime(200,1,2) };
DayItemsControl.ItemsSource = week;