开发者

Bind Winform control property to a property on User Control using INotifyPropertyChanged

Please advise me. Winforms app, C#. I have a user control (UC) that contains a DataGridView.

Firstly, I have a boolean public property in the UC called "IsComplete". in the开发者_开发技巧 RowEnter event of my DGV, Im able to set the property accordingly.

Secondly, I successfully instantiate and load this UC into its designated area in my Main form.

PROBLEM: I would like the 'Enabled' property of a control in my Main form to respond to the IsComplete property in my UC automatically when it changes.

Is this possible? All my searches on Google refer to examples using INotifyPropertyChanged, but only on the same class.

I would certainly appreciate any help on this. TIA!

-cheers!


Why you don't fire off an event when your IsComplete property gets set? This sounds like a pretty trivial thing to do with either events or delegates in c#?!

If you have more complex sort of requirements you should look into the the observer desgin pattern here and here.

It basically allows you to register listener objects to whatever object that changes its states and then action accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜