Setting selected combo box item in XAML?

Ribbon for WPF Forum

Posted 17 years ago by Brad Daszynski
Version: 1.0.0347
If I have a ribbon combobox, such as:

<ribbon:ComboBox Width="200" Label="Something:" KeyTipAccessText="F1">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>

Is there a way to set it so the first item in the combo box is selected?

Comments (3)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Yes use this line:

<ComboBox SelectedIndex="0">

Actipro Software Support

Posted 15 years ago by Mina
How about setting a specific item as selected for a PropertyGrid combo box? Thanks!
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Maggie,

Please post questions relating to the PropertyGrid in the PropertyGrid (for WPF) Support forum.

To answer your question, the controls in the PropertyGrid are meant to work of an associated property/object. So if you have a property call MyProperty, then the ComboBox would show the current value. You can then provide a list of possible "standard" values to choose from, which can be displayed by the ComboBox. So ultimately, you change the selected item of the ComboBox by changing the associated property.

If you have a specific scenario where you are having problems, please email over a small sample project and we can take a closer look.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.