views:

386

answers:

1

Hi there!

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!

+1  A: 

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.

afgallo
:$ i feel like such a dumb@$$!! U 100% right, and i couldnt think of the simplest thing! serves me right for staying awake too long. I set up my my EventHandlers and methods and got it working perfectly now.(*hangs head in shame*)
Shalan