I created a custom silverlight control consisting of two date pickers and a combobox. I would like to do combobox data binding, and I know that I need to use DependencyProperty. What I'm not sure is exactly how to build it. Here is the code I have:
#region ItemsSource (DependencyProperty)
public IList ItemsSource
{
get { return (IList)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
}
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register("ItemsSource", typeof(int), typeof(DateRangeControl),
new PropertyMetadata(0));
#endregion
The problem is that all the patterns I've seen are for simple properties like Text or Background that expect either a string, int, or color. Since I'm trying to bind to a combobox ItemsSource element, it expects IEnumerable, I did not know how to build a property for this. I used IList.
Can someone please tell me if I'm on the right track and give me some pointers? Thanks
Hector