How to extract XMLElement of selectedItem of ListBox in WPF?

Apr 4 2015 6:07 PM

Problem Background:

In my WPF application, in one of the window/page contains 3 List Boxes and 1 ComboBox. These 3 ListBoxes are binded with XML dataprovider and there is no issues. I mean when 1st listbox selection changes automatically updates listbox2. In the same way, listbox3 updates as listbox2 changes. These are all worked out in XAMl file alone and there is code-behind except InitializeComponent() and few lines of code for loading this XAML file dynamically using XAMLReader(this is my requirement)

Problem facing Requirement:

OnSelection change event of any of the ListBox, need to populate ComboBox data dynamically( it will fire webservices which is based on above mentioned 3 LisBox selection). For this purpose, in SelectionChange I am trying to get

ListBoxObj.SelectedItem - Always contains XML tree.(i.e) of type XMLElement

I have tried all possiblities, everywhere I am getting only XML tree.

Anyone have any idea, how to extract ListBox selected Item Text from XMLElement?

Thanks


Attachment: wpf_xaml_query.zip

Answers (4)