Possible duplicate:
WPF: XAML property declarations are not set via Setters?
I am stuck in a seemingly stupid problem.
I have a user control, MyControl.xaml and MyControl.xaml.cs defines a public dependency property:
public static readonly DependencyProperty VisibleItemsProperty = DependencyProperty.Register("VisibleItems", typeof(object), typeof(MyControl)); public object VisibleItems { get { return (object)GetValue(VisibleItemsProperty); } set { SetValue(VisibleItemsProperty, value); } }
In another view of SomeOtherViewA, I declare my control:
<cc:MyControl VisibleItems="{Binding VisibleTables}" />
VisibleTables is a dependency property in SomeOtherViewModelA viewmodel.
I know that VisibleTables returns values because it is connected to other controls in SomeOtherViewA (like ListBox) and they work fine.
For some reason, the dependency property inside my user control is never set. Am I missing something?
source share