I have a C# custom WPF control. I have properties on the control that are based on DependencyProperty's.
public static readonly DependencyProperty CurrentStateProperty =
DependencyProperty.Register( "CurrentState", typeof(ControlStateEnum),
typeof(MyCustomControl), new PropertyMetadata(ControlStateEnum.Started));
public ControlStateEnum CurrentState
{
get { return (ControlStateEnum) GetValue(CurrentStateProperty); }
set { SetValue(CurrentStateProperty, value); }
}
Now, if I use the control, and try to use it, ala:
<myControls:MyCustomControl CurrentState="Loaded" />
The CurrentState never gets set to "Loaded" and remains "Started". I want to make it capable of binding, but also capable of being set without binding... Is there something I don't understand or am missing?
When I set a breakpoint on the setter, it doesn't update on the window load.