5
Answers

xmlDataProvider Issues

RIck Mueller

RIck Mueller

14y
5.9k
1

This is what I have, I not able to populate the listbox. Any Help?
This is wht I have in my Window.Resources
 <XmlDataProvider x:Key="Recipe"
                   Source="/Database/Recipe.xml"
                   XPath="Tables/Table"/>
  <CollectionViewSource x:Key="CallRecipes"
                        Source="{StaticResource Recipe}">
    <CollectionViewSource.SortDescriptions>
      <scm:SortDescription PropertyName="Station"
                           Direction="Ascending"/>
    </CollectionViewSource.SortDescriptions>
  </CollectionViewSource>
This is my XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NewDataSet1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <Table>
  <RecipeID>117</RecipeID>
  <RecipeName>16/20 Shrimp</RecipeName>
  <RecipeCount>Box</RecipeCount>
  <RecipeYield>3</RecipeYield>
  <ShelveLife>4</ShelveLife>
  <PrepTime>0.00347222222222222</PrepTime>
  <Station>PULL</Station>
  <RecipeCost>3</RecipeCost>
 </Table>
This is what I'm using to bind to the listbox
<ListBox HorizontalAlignment="Right" Margin="0,74,42,87.833" 
     DisplayMemberPath="Station"
     ItemsSource="{Binding Source={StaticResource CallRecipes}}"
     Width="305"/>
Where did I go wrong?
Thanks
 

Answers (5)