I have created a Generic WPF Control, so the layout is all defined in code. This is all fine and I have added bindings which work first time round, for example:
private bool btEnabled { get { return SOME_LOGIC; } }
Button bt = new Button { Content = "Button" };
bt.SetBinding(Button.IsEnabledProperty, new Binding { Source = btEnabled, Mode = BindingMode.OneWay });
Whenever something happens which affects btEnabled property I am calling INotifyPropertyChanged but the PropertyChanged event is always null, I can’t work out why the binding isn’t registering the PropertyChanged event.
Any Ideas?
Thanks
I see that
btEnabledis a property, that too private!So presumably there are two mistakes…
Your
Bindingshould setPath="btEnabled"notSource=btEnabledAnd your btEnabled property should be public.