By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,702 Members | 1,496 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,702 IT Pros & Developers. It's quick & easy.

Can I ignore xxxChanged events while data binding?

P: n/a
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Larry

you could use removehandler and addhandler on the controls, remove all the
handlers before databinding and then add them again afterwards

Hope this helps

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Larry Lard" <la*******@hotmail.com> schreef in bericht
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #2

P: n/a
Not sure but you could also try SuspendBinding. REsumeBindig...

--

"Larry Lard" <la*******@hotmail.com> a écrit dans le message de
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.