Share via


Choice.DefaultIndex Property

Gets or sets the index of the default object within the Options list.

Syntax

  public int DefaultIndex {get; set;}

Property Value

System.Int32.  The index value.

This property is read/write.

Remarks

By default, the first option (index=0) is selected as the initial value. You can choose a different initial value using the DefaultIndex property by creating a rule.

For example, the following markup defines a list of options, but the DefaultIndex property is not yet used, and the initial value is set to Option1:

  <Choice Name="Options" DefaultIndex="3">
    <Options>
        <cor:String String="Option1"/>
        <cor:String String="Option2"/>
        <cor:String String="Option3"/>
        <cor:String String="Option4"/>
    </Options>
</Choice>

To set the default index value when the UI is created, create a rule that does not have a condition, but has an Invoke action to call Choice.DefaultValue:

  <Actions>
    <Invoke Target="[Options.DefaultValue]" />
</Actions>

You can reset the default value at any time by using the Choice.DefaultValue method.

Requirements

Reference: Microsoft.MediaCenter.UI

Namespace: Microsoft.MediaCenter.UI

Assembly: Microsoft.MediaCenter.UI.dll

Platform: Windows Vista Ultimate, Windows Vista Home Premium, and later

See Also