Udostępnij za pośrednictwem


RadioButtons.SelectedIndex Property

Definition

Gets or sets the index of the selected radio button.

public:
 property int SelectedIndex { int get(); void set(int value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
int SelectedIndex();

void SelectedIndex(int value);
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
int SelectedIndex();

void SelectedIndex(int value);
public int SelectedIndex { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")] set; }
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")]
public int SelectedIndex { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="-1")] set; }
var int32 = radioButtons.selectedIndex;
radioButtons.selectedIndex = int32;
Public Property SelectedIndex As Integer

Property Value

Int32

int

The index of the selected radio button. The default is -1, which indicates that no radio button is selected.

Attributes
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute

Remarks

For more info, design guidance, and code examples, see Radio buttons.

SelectedItem and SelectedIndex are synchronized. Changing either property will result in a change to the other. Setting SelectedIndex to any value outside the range of the Items collection results in SelectedItem being null.

Applies to

See also