开发者

checkbox databinding

开发者 https://www.devze.com 2023-03-06 19:51 出处:网络
I have a problem with System.Window.Form.CheckBox databinding. I have code: checkBox1.DataBindin开发者_高级运维gs.Add(\"Checked\", _movementsBindingSource, \"Moved\", true);

I have a problem with System.Window.Form.CheckBox databinding. I have code:

checkBox1.DataBindin开发者_高级运维gs.Add("Checked", _movementsBindingSource, "Moved", true);

It's working, but i want invert checkBox1.Checked. If Moved is true, then checked = false. Can you help me with this problem?


That's a common problem and you have two options:

  1. Create another field in the _movementsBindingSource which will be exact inverse of the 'Moved' field and bind to it.
  2. Do the databinding manually and handle the checked changed events yourself.

By default, databinding doe not have an 'inverse bool binding' sort of an option.

0

精彩评论

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