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

Multi-source binding

1 Answer 48 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 21 Oct 2011, 07:08 PM
Hi,

I am fairly new to Telerik so I will explain the issue as best I can.  The goal is to bind the list to an enum and the SelectedValue to a value in another object.

So, I have a combobox that needs populated from an enum. The enum consists of two strings, ShortName and DisplayText.  I am able to get the combobox to bind and have the DisplayText appear which is great.  With my HTML background I expect to be able to set a DDL's value and text separately.  It appears that if I set the text it sets that as the value as well.  Is this correct?

The reason for this necessity is that I am attempting to bind the SelectedItem to a value retrieved from a database.  The ShortName property in the enum is being brought back from the database but I need to show the DisplayName. 

I am used to this being pretty simple.  Anybody know what I am missing here???

Thanks!

-Will

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 25 Oct 2011, 09:26 AM
Hi William,

Please, find attached a simple application that demonstrates your request. The idea of data-binding in Silverlight is a little bit different than ASP.NET - in Silverlight you feed the ItemsControl directly with the data items from the database, setting DisplayMemberPath to specify which property should be used for display text (or you could use ItemTemplate instead if you want more complex UI).

Regards,
Valeri Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ComboBox
Asked by
William
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or