Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i fill my combobox with the following code:
C#
<pre> var result = (from a in  dbContext.tbl_Representaion select a).ToList();
            cmbRepresentation.ItemsSource=result;
            cmbRepresentation.DisplayMemberPath = "Name";
            cmbRepresentation.SelectedValuePath = "ID";</pre>


and myXaml Code:
XML
<pre> <ComboBox FlowDirection="RightToLeft" Height=" 25" HorizontalAlignment="Right" Margin="0,6,5,0" Name="cmbRepresentation" SelectedIndex="-1" VerticalAlignment="top" Width="100" SelectionChanged="cmbRepresentation_SelectionChanged" SelectedValue="{Binding Path=SelectedValue, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedItem}">
           
        </ComboBox
>

now ,how when load data ,I display item for ID required with selected value or selected item(not selectedIndex)?
Posted
Updated 1-Sep-15 21:34pm
v2

1 solution

Set either the SelectedItem or the SelectedIndex
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900