【发布时间】:2017-07-09 17:57:28
【问题描述】:
我有一个类 Person,它有一个名为“流派”的布尔属性,其值将 对男孩来说是真的,对女孩来说是假的。
我需要在 Person.genre 和两个 RadioButtons 之间创建一个双向绑定
这样当我的 person 对象填充了来自数据源的数据时
RadioButtons 将被相应地设置(如果 Person.genre
为真,如果Person.genre 为假,女性 RadioButton 检查)或用户是否点击
如果用户单击女性,男性 RadioButton Person.genre 将设置为 true
RadioButton Person.genre 将被设置为 false。
请帮助我获得最合适的做法:应该
我使用Bindings API,RadioButton.bindBidirectional 方法与
Person.genreProperty() 或相反,甚至使用更改监听器???
最好的问候, 罗莫尔多。
【问题讨论】: