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

Display data in RadCombobox using silverlight

3 Answers 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sankar
Top achievements
Rank 2
Sankar asked on 29 Aug 2008, 10:56 AM
I am using WCFService to populate data using Linq SQL class to Silverlight application.

Now I need to display data in to RadCombobox. Kinldy provide the solution

3 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 29 Aug 2008, 12:26 PM

Hi Sankar,

To populate RadComboBox from a collection, you need to set the control's ItemsSource property. To specify which is the initially selected item in RadComboBox you need to set SelectedIndex or SelectedItem properties. I am not sure that I understand the question correctly, please, let me know if my answer does not provide a solution for your problem. 

Best wishes,

Valeri Hristov (Silverlight Team)
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sankar
Top achievements
Rank 2
answered on 15 Sep 2008, 04:18 AM
Kindly let us know how to set Key & Value for the Drop down list similar to ASP.NET
0
Valeri Hristov
Telerik team
answered on 15 Sep 2008, 07:36 AM
Hello Sankar,

The Silverlight controls do not provide the ability to set Key/Value for their items. Instead, it the control is databound you could directly access the data item of the selected RadComboBoxItem:

List<Product> products = new List<Product>();
products.Add(new Product() { ID = 1, Name = "Product1", Description = "Short description 1" });
products.Add(new Product() { ID = 2, Name = "Product2", Description = "Short description 2" });
products.Add(new Product() { ID = 3, Name = "Product3", Description = "Short description 3" });
// You could populate the products list from a service instead
// but the code, related to RadComboBox will be the same
RadComboBox1.ItemsSource = products;
...
private void RadComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    Product selectedProduct = RadComboBox1.SelectedItem as Product;
    //You can access all properties of the actual Product object that is bound to
    // currently selected RadComboBoxItem
    ...
}

I hope this helps.

All the best,
Valeri Hristov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Sankar
Top achievements
Rank 2
Answers by
Valeri Hristov
Telerik team
Sankar
Top achievements
Rank 2
Share this question
or