wpf - binding to a radio button -



wpf - binding to a radio button -

i have next radio button bound variable isallowed

<radiobutton name="yesradiobutton" margin="5,5,0,0" ischecked="{binding path=isallowed, mode=twoway}">yes</radiobutton>

how can create no button take opposite value using xaml ?

there no xaml-only solution. bind no using reverse bool converter though.

<local:notconverter x:key="notconverter"/> {binding isallowed, mode=twoway, converter=notconverter} public class notconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { boolean result = false; if (value boolean) result = !((boolean)value); homecoming result; } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { boolean result = false; if (value boolean) result = !((boolean)value); homecoming result; } }

wpf radio-button bind

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -