silverlight : Checkbox checked/unchecked with another checkbox checked/unchecked -


i have few checkbox's (8 of them) 1 of enable/disable other 7 checkbox's.

for have written as,

isenabled="{binding elementname=controlchkenable, path=ischecked, mode=oneway}" ischecked="{binding elementname=controlchkenable, path=ischecked, mode=oneway}" 

in every dependent cb's. enable/disable working fine, if master checkbox unchecked, other checkbox's not getting unchecked, getting disabled.

any idea went wrong?

when checkbox disabled cannot change value.

to in mvvm, have change values before disabled main checkbox :

c#

/// <summary> /// bind ischecked of "controlchkenable" element (twoway) /// , bind isenabled of each of other 7 checkbox's (oneway) /// </summary> public bool controlchkenable {     { return _controlchkenable; }     set     {         if (value == _controlchkenable) return;         _controlchkenable = value;         // before informing checkboxes disabled,         // pass values ​​to uncheck         if (!_controlchkenable)         {             check1 = false;             // check2 = false;             // check...= false;         }         // raise ui value changed         raisepropertychanged("controlchkenable");     } } private bool _controlchkenable;  /// <summary> /// bind ischecked of 1 of other 7 checkbox's (twoway) /// </summary> public bool check1 {     { return _check1; }     set     {         if (value == _check1) return;         _check1 = value;         raisepropertychanged("check1");     } } private bool _check1; 

xaml :

<!-- main checkbox --> ischecked="{binding controlchkenable, mode=twoway}"  <!-- other checkbox's --> isenabled="{binding controlchkenable, mode=oneway}" ischecked="{binding check1, mode=twoway}" 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -