WPF + MVVM + RadioButton : How to handle binding with single property?

You need a IValueConverter. //define this in the Window’s Resources section or something similiarly suitable <local:GenderConverter x:Key=”genderConverterKey” /> <RadioButton Content=”M” IsChecked=”{Binding Gender, Converter={StaticResource ResourceKey=genderConverterKey}, ConverterParameter=M}” /> <RadioButton Content=”F” IsChecked=”{Binding Gender, Converter={StaticResource ResourceKey=genderConverterKey}, ConverterParameter=F}” /> The converter public class GenderConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return ((string)parameter … Read more

Why do Tkinter’s Radio Buttons all Start Selected When Using StringVar but not IntVar?

In the case of the second set of radiobuttons, they are being rendered in “tri-state mode”. According to the official documentation1: If the variable’s value matches the tristateValue, then the radiobutton is drawn using the tri-state mode. This mode is used to indicate mixed or multiple values. Explanation The default for tristatevalue is the empty … Read more

In JavaScript, how can I get all radio buttons in the page with a given name?

You can use document.getElementsByName(), passing the name of the radio group, then loop over them inspecting the checked attribute, e.g. something like: function getCheckedValue( groupName ) { var radios = document.getElementsByName( groupName ); for( i = 0; i < radios.length; i++ ) { if( radios[i].checked ) { return radios[i].value; } } return null; }

Best way to databind a group of radiobuttons in WinForms

Following is a generic RadioGroupBox implementation in the spirit of ArielBH’s suggestion (some code borrowed from Jay Andrew Allen’s RadioPanel). Just add RadioButtons to it, set their tags to different integers and bind to the ‘Selected’ property. public class RadioGroupBox : GroupBox { public event EventHandler SelectedChanged = delegate { }; int _selected; public int … Read more

jQuery set radio button

Your selector looks for the descendant of a input:radio[name=cols] element that has the id of newcol (well the value of that variable). Try this instead (since you’re selecting by ID anyway): $(‘#’ + newcol).prop(‘checked’,true); Here is a demo: http://jsfiddle.net/jasper/n8CdM/1/ Also, as of jQuery 1.6 the perferred method of altering a property is .prop(): http://api.jquery.com/prop