Silverlight / WPF - How to bind Employee details to silverlight Combobox EmpName ,empid ??

Asked By Ramesh Nalla on 07-Feb-12 01:29 AM
Hi All,

can any one please help me for this problem..

i want to bind EmpName and EmpId to silverlight combobox.. In DataTextField and DataValueField properties are there for doing this but how to do in silverlight combobox..?

Waiting for your reply.


D Company replied to Ramesh Nalla on 07-Feb-12 01:53 AM
hello friend,

try like this

<ComboBox Height="23"  HorizontalAlignment="Left"  SelectedValue="{Binding EmpID, Mode=TwoWay}"  SelectedValuePath="Content" Margin="126,54,0,0" x:Name="comboBox1"   VerticalAlignment="Top" Width="120" DisplayMemberPath="Content"> 
<ComboBoxItem x:Name="x" Content="test2"></ComboBoxItem>  
<ComboBoxItem x:Name="x2" Content="test">

here is a good Article on this

Mahendar Nanamala replied to Ramesh Nalla on 07-Feb-12 02:01 AM
You can try below one
<ComboBox x:Name="cbb" Height="30"  Width="200"  DisplayMemberPath="State" SelectedValuePath="Id" />
Ramesh Nalla replied to Mahendar Nanamala on 07-Feb-12 02:09 AM
Hi Mahendar,

but SelectedValuePath property is not there in silverlight ...iam using silverlight version 3.