Author Topic: Want to pass items around without casting....  (Read 7868 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Want to pass items around without casting....
« Reply #15 on: December 10, 2008, 07:11:42 PM »
Having looked at that example, its important to understand that the OnPropertyChanged detail is telling the bindingobject to update all controls hooked to the object, not just controls "involving" the scalefactor.
The fact is, we never told it some controls are dependent and some are not so it has to be that way.

Not a single one of my 5 VB.net or C# books mention using objects, only databases for this.  Its just one of those things that was so close, it would have bit me if it was a snake.

James Maeding

pkohut

  • Guest
Re: Want to pass items around without casting....
« Reply #16 on: December 10, 2008, 08:16:26 PM »
Having looked at that example, its important to understand that the OnPropertyChanged detail is telling the bindingobject to update all controls hooked to the object, not just controls "involving" the scalefactor.
The fact is, we never told it some controls are dependent and some are not so it has to be that way.

Not a single one of my 5 VB.net or C# books mention using objects, only databases for this.  Its just one of those things that was so close, it would have bit me if it was a snake.



Set CausesValidation to false for the controls you don't want to participate in validation post backs.  See the
MSDN docs for "User input validation in Windows forms" and "Control.Validating Event".

Also, you may be interested in looking at the Property Grid control.  Through reflection, a bound object's
public properties are automatically shown in the grid.  Then through the use of attributes you can
control how the grid looks and feels.  Again, MS has a pretty good write up called
"Getting the Most Out of the .NET Framework PropertyGrid Control".

Paul



jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Want to pass items around without casting....
« Reply #17 on: December 11, 2008, 11:15:44 AM »
Good tips, thx
James Maeding

TonyT

  • Guest
Re: Want to pass items around without casting....
« Reply #18 on: December 12, 2008, 12:23:19 AM »

Set CausesValidation to false for the controls you don't want to participate in validation post backs.  See the
MSDN docs for "User input validation in Windows forms" and "Control.Validating Event".

Also, you may be interested in looking at the Property Grid control.  Through reflection, a bound object's
public properties are automatically shown in the grid.  Then through the use of attributes you can
control how the grid looks and feels.  Again, MS has a pretty good write up called
"Getting the Most Out of the .NET Framework PropertyGrid Control".

Paul


The example uses an updown control, which is a
bit of a special case.

There is no control validation when you click the
up/down button regardless of what CausesValidation
is set to, yet the bound property's value is changed.

That's the reason why the datasource update mode
is set to OnPropertyChanged.