Simple ComboBox and setting/getting value

2 posts, 0 answers
  1. Grzesiek
    Grzesiek avatar
    87 posts
    Member since:
    Jun 2007

    Posted 20 Mar 2012 Link to this post

    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" />

    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?
  2. Georgi
    Georgi avatar
    362 posts

    Posted 23 Mar 2012 Link to this post

    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.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top