Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

WPF ComboBoxes not displaying the selected item. how to show that selected text.

for loop...

C#
ComboBoxItem yrbDef = new ComboBoxItem();
Content = "None";
cbExisProj.Items.Add(yrbDef);

here i cant show the selected text and also cant able to get the value also.


Thanks
GSS
Posted
Updated 2-Mar-14 23:16pm
v2

1 solution

Of course its not showing the item, cause you've only added it.
You also have to change the selected index to the index of the recently added item.

C#
comboBox.SelectedIndex = comboBox.Items.Add(cbItem);
 
Share this answer
 
v2
Comments
Gssankar 3-Mar-14 4:59am    
thanks for your reply i will check.. thanks again...

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