I have a listbox that populates expander controls the header and content is binded. I want to be able to SelectItem to a TextBlock.. Currently I'm using {Binding SelectedItem.Content, ElementName=Listbox}. I tried binding to the expander and the textbox that the Expanders populates in the expander. But no results.
Any Thoughts?
Binding SelectItem Content
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Raaj KumarRank #7,836 · 233 reputationPosted Feb 23, 2010, 9:30 PM EST
Hi,
Instead of using SelectedItem.Content try using SelectedItem only. Since the data is binded using XML data source you should a value converter for doing some data extraction. For create a class which inhererits from IvalueConverter.
public class XmlValueConverter:IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ///Write your logic return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion }and XAML,
while running the application try putting breakpoint and check the result such that it would help you in writing your logic
Regards,
raaj
RIck Mueller45 reputationPosted Feb 24, 2010, 3:54 AM EST
Any thoughts?