This is a migrated thread and some comments may be shown as answers.

Simple ComboBox and setting/getting value

1 Answer 21 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Grzesiek
Top achievements
Rank 2
Grzesiek asked on 20 Mar 2012, 08:39 PM
Hello! 
I want to have ComboBox with only 2 values. I have already:

<telerik:RadComboBox HorizontalAlignment="Left" Name="radComboBox1" Grid.Column="1" Height="22" SelectedIndex="0">
<telerik:RadComboBoxItem Content="Simple" />
<telerik:RadComboBoxItem Content="Advanced" />
</telerik:RadComboBox>

How can I assign values to these items? Example:
Content="Simple" -> Value="1";
Content="Advanced" -> Value="2";

Is this available? How can I make this?

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 23 Mar 2012, 01:50 PM
Hello Grzesiek,

What you can do is use binding to an object. So your object can have two values one to be displayed and one to be used as SelectedVlue. More on how to achieve that you can find here, also you can see this Silverlight demo or its WPF equivalent. To specify which one to be displayed you can use DisplayMemberPath and to specify witch one to be used as selected value - SelectedValuePath.


Regards,
Georgi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ComboBox
Asked by
Grzesiek
Top achievements
Rank 2
Answers by
Georgi
Telerik team
Share this question
or