My goal is to write this in XAML:
<Grid>
<Rectangle Fill="AliceBlue"
myCore:MyTimePanel.BeginningDate="03/03/2010"
/>
</Grid>
Problem:
Silverlight XAML cannot parse a DateTime from a string. Therefore, at runtime, I have a XamlParseException exception "cannot create DateTime from this string".
When I use a simple DependencyProperty, I just add TypeConverterAttribute to getter / setter and it works. Like this (idea here ):
[TypeConverter(typeof(DateTimeTypeConverter))]
public DateTime MyDate
{
get { return (DateTime)GetValue(MyDateProperty); }
set { SetValue(MyDateProperty, value); }
}
But with DP attached , there is no getter / setter. What can I do to write string date in XAML?
Thank!