Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inverse databinding....
Message
From
20/09/2007 16:52:14
 
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01255502
Message ID:
01255850
Views:
10
Yeah, definitely overkill in this situation, but a pretty cool solution, nonetheless. Are you going that route or are you taking care of it in the CheckedChanged event? .

~~Bonnie



>Hi,
>I thought of one way:
>Binding b = new Binding("Enabled", this.chkDifferential, "CheckState");
>b.Format += new ConvertEventHandler(ReverseState);
>chkOverWrite.DataBindings.Add(b);
>
>private void ReverseState(object sender, ConvertEventArgs cargs)
>  {
>  cargs.Value = (CheckState)cargs.Value == CheckState.Checked ? CheckState.Unchecked : CheckState.Checked;
>  }
>
Not particularly worthwhile in such a simple context but ...
>Best,
>Viv
>
>>That's cool Viv ... I would have never thought to use DataBinding that way.
>>
>>I can't think of a way to make it behave the opposite though, not with DataBinding anyway. You might have to bite the bullet and set the enable/disable in the chkDifferential's CheckedChanged event.
>>
>>~~Bonnie
>>
>>
>>
>>>Hi,
>>>
>>>Simple piece of databinding between two checkboxes:
>>>
chkOverWrite.DataBindings.Add("Enabled", this.chkDifferential, "Checked");
>>>Any suggestions of how best to achieve the opposite result - i.e. chkOverWrite *disabled* when chkDifferential.Checked
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform