Hello, I have created a custom silverlight control, which consists of two date pickers, and a combobox. I would like to make the combobox data-bindable and I know I need to make use of a DependencyProperty. What I am not sure of is exactly how to build it. Here is the code that I have:
#region ItemsSource (DependencyProperty)
/// <summary>
/// ItemsSource to bind to the ComboBox
/// </summary>
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 samples I have seen are for simple properties like Text or Background wich expect either a string, int, or color. Since I am trying to bind to the combobox ItemsSource, it expects a IEnumerable, I did not know how to build the property for this. I used IList.
Can someone please let me know if I am on the right path and give me some pointers? Thanks