c# - How to Bind a nullable bool in VM to RadRadioButton -
i struggling how go this? in vm have nullable bool
property want bind yes/no(true/false) radradiobutton
. can point me in right direction?
vm
public bool? issds { get; set; }
view
<telerik:label content="self directed support" /> <stackpanel orientation="horizontal"> <telerik:radradiobutton x:name="selfdirectedsupportyes" content="yes" /> <telerik:radradiobutton x:name="selfdirectedsupportno" content="no" /> </stackpanel>
edit
i thought working mistaken. yes binding. below what's on view, createauthview
:
<stackpanel orientation="horizontal" margin="3" grid.column="1" grid.row="2"> <telerik:radradiobutton x:name="authorization_selfdirectedsupportyes" groupname="sds" content="yes" /> <telerik:radradiobutton x:name="authorization_selfdirectedsupportno" groupname="sds" content="no" /> </stackpanel>
and here corresponding portion on viewmodel, createauthviewmodel
:
public authorization authorization { { return this.authorization; } set { if (authorization != value) { this.authorization = value; notifyofpropertychange(() => authorization); } } }
and property on model, authorization
:
public bool? selfdirectedsupportyes { { return this.selfdirectedindicator; } set { this.selfdirectedindicator = value; this.onpropertychanged(); } }
ischecked
of type nullable<bool>
, can bind directly "yes" radio button. , if set same groupname
both radio buttons, don't need bind "no" radio button @ (since checking "no" uncheck "yes")
<telerik:label content="self directed support" /> <stackpanel orientation="horizontal"> <telerik:radradiobutton x:name="selfdirectedsupportyes" groupname="selfdirectedsupportoption" content="yes" ischecked="{binding issds}" /> <telerik:radradiobutton x:name="selfdirectedsupportno" groupname="selfdirectedsupportoption" content="no" /> </stackpanel>
Comments
Post a Comment