Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

I want my chart title to bind to the selected item in a combobox, how do i do this?.

a simple element binding, with selected item/value as a path doesn't work.

code:
Title="{Binding Path=SelectedItem, ElementName=ComboBoxDetailed}"


thanks!
Posted
Updated 25-Aug-11 1:11am
v2
Comments
Simon Bang Terkildsen 25-Aug-11 7:01am    
post your xaml and the binding that doesn't work, and lets go from there.
Wayne Gaylard 25-Aug-11 8:04am    
You are binding to the SelectedItem, but what sort of collection does the ComboBox contain? Is it a collection of strings, or a collection of a class?
CrafterIt 25-Aug-11 10:28am    
Hi!

Thanks you gave me an ide of what was wrong, it was a collection of a class, but now i have converted it to a colleciton of strings and now the binding works like a want it to :)

If you have a collection of a class, can you still do this binding some other way?
Wayne Gaylard 26-Aug-11 2:05am    
Yes, you can you just have to bind to the specific property of the class. Something like SelectedCustomer.Name etc.
CrafterIt 1-Sep-11 2:37am    
Thanks :)

1 solution

Hi,

If you are using ComboBoxItem as Selected Item then you need to set SelectedItem.Content then only it will Bind.



Regards
Siraz
 
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