Hi,
I am trying to bind a ListBox to Xml in Button_Click event in xaml.cs. my Xml is simple
<books>
<book>ABC/book>
<book>XYZ</book>
</books>
Here's what I am doing..
in xaml.cs
XmlDocument x = new XmlDocument(); x.LoadXml(e.Result.ToString()); listbox1.ItemsSource = x;
and Xaml is
<ListBox x:Name="lstbxTrends" Margin="95,112,8,18" ItemsSource="{Binding XPath=Books}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding XPath=@Book}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
But nothing shows up in Listbox..?
Thanks guys!