Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Bind listbox to an xml file at run time

$
0
0

I'm sure this is a simple issue, but I'm just getting to grips with xaml. I have a vb WPF browser app in VS2012 with a listbox control bound to a simple xml file (ValueList containing Value elements). Here's the xaml

<Page.Resources>        <XmlDataProvider x:Key="Feature"  Source="\\10.132.1.53\sites\products\common\feature_metadata_values.xml"  XPath="ValueList/Value" IsInitialLoadEnabled="True"  />        </Page.Resources><Grid><ListBox ItemsSource="{Binding Source={StaticResource Feature}}" 
                 x:Name="FeatureLB" HorizontalAlignment="Left" Height="176" Margin="37,42,0,0" 
                 VerticalAlignment="Top" Width="150"  SelectionMode="Multiple" />

...
...

At design time the binding looks good - the listbox is populated as I'd expect. But publishing this as-is, just xaml with no code-behind, the list box is empty. I'm sure I'm missing something stupidly obvious, but how do I get it to populate at run time?

Thanks

Pete



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>