Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
I am having two XML files.

Events.xml and Seminar.xml. I am using xaml data provider. My question is how to bind these two XML files to a single list box, single XML file I am able to bind through this code.
HTML
<Window.Resources>
  <XmlDataProvider x:Key="ProductData"
                   Source="/Product.xml"
                   XPath="Products/Product" />
</Window.Resources>

And binded it to the list box using -
HTML
<ListBox 
   ItemsSource="{Binding 
                 Source={StaticResource ProductData}}"
   DisplayMemberPath="ProductName" />.its working
now i want to to bind two xml files to change the ui continously.i asked m sir he told use collection view source.i searched but iam unable to find out how to do.the place where i lacked is
 <XmlDataProvider x:Key="ProductData"
                   Source="/Product.xml"...///here i have two xml files then how to specify the source
                   XPath="Products/Product" />...here also 
  <CollectionViewSource x:Key="collProducts"
                        Source="{StaticResource ProductData}">

Any one please help me.

Thanks in advance.
Posted
Updated 8-Dec-11 23:22pm
v2

1 solution

You're easier handling the CollectionViewSource in the code behind to achieve what you need. See my example here MVVM ListBox Grouping[^] that has an example of the CollecitonViewSource being manipulated in the code. From this, it should be easy to merge your two xml files into the list.
 
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