I have a dependency property(List of string) in a user control in my dot net assembly as below
public partial class ItemSelectionUserControl : UserControl
{
public List<string> AvailableItems
{
get { return (List<string>)this.GetValue(AvailableItemsProperty); }
set { this.SetValue(AvailableItemsProperty, value); }
}
public static readonly DependencyProperty AvailableItemsProperty = DependencyProperty.Register(
"AvailableItems", typeof(List<string>), typeof(ItemSelectionUserControl), new FrameworkPropertyMetadata{BindsTwoWayByDefault =true});
public ItemSelectionUserControl()
{
InitializeComponent();
}
}
I am trying to use this usercontrol in another usercontrol in a different assembly as below
<UserControl
xmlns:ctrl="clr-namespace:HH.Windows.UserControls;assembly=HH.Windows.UserControls"
/>
// .....
<Grid>
<ctrl:ItemSelectionUserControl Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3" AvailableItems="{Binding Path=CheckList}"/>
</Grid>
I can see the get accessor of CheckList is getting called, but it is not setting the dependency property "AvailableItems". The breakpoint in the set of "AvailableItems" is never getting called. What am I doing wrong?