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

Selected in C#

1 Answer 38 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Louis Bouchard
Top achievements
Rank 1
Louis Bouchard asked on 13 Jul 2010, 02:10 AM

Hello,

My RadComboBox display a list of language and I need to select one from C#.  This is my code :

<telerik:RadComboBox x:Name="RadComboBoxLstLg" ItemsSource="{StaticResource languages}" DisplayMemberPath="Name" />

And this is my class :

public class AvailLanguage : List<Language>
{
    public AvailLanguage()
    {
        this.Add(new Language() { Name="English", Code="en-US" });
        this.Add(new Language() { Name = "Fran├žais (Canada)", Code = "fr-CA" });
        this.Add(new Language() { Name = "Spanish", Code = "es-ES" });
    }
}
public class Language
{
    public string Name { get; set; }
    public string Code { get; set; }
}

Someone can tell (when my XAML page is loaded) how I can display in my RadComboBox I specific language by example es-ES.
 


1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 13 Jul 2010, 08:09 AM
Hello Louis,

The easiest way to select an item is to use the SelectedIndex property of RadComboBox:
RadComboBoxLstLg.SelectedIndex = 2;

There are other properties that control the selection:
http://www.telerik.com/help/silverlight/radcombobox-features-selection.html

All of them are read/write so you could use any of them to select an item and to get the selected item.

Best wishes,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
Louis Bouchard
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or