I have a listbox which uses an XMLDataProvider as datacontext and is bound to an XPath query which returns a number of nodes with different names.
These names will vary at runtime therefore are unknown at design time and must be accessed dynamically.
I am trying to set the Item template to display both the name of the node and the value it holds. I can get the name through {Binding Name} but can't seem to get the value (I already tried {Binding Value}) - can anyone help?
XAML:
Example XPATH result:Code:<ListBox Margin="2" ItemsSource="{Binding XPath=variables/*}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Margin="2" Text="{Binding Name}"></TextBlock> <TextBlock Margin="2" Text="{WHAT GOES HERE?}"></TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
So with the example I'm looking for the listbox to show 3 lines:Code:<variables> <SourceFolder>[WORKROOT]\startfolder</SourceFolder> <TargetFolder>[WORKROOT]\endfolder</TargetFolder> <ReadOnly>True</ReadOnly> </variables>
SourceFolder [WORKROOT]\startfolder
TargetFolder [WORKROOT]\endfolder
ReadOnly True




Reply With Quote