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
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.
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.