Reputation: 939
I have a Menu and a TreeView defined in my MainWindow.XAML. In Designtime they show their content but not in Runtime:
<-- Designtime
<-- Runtime
Since the XML data is provided in the actual MainWindow.XAML file I can't see how it can be a designtime vs runtime reference error like the many image examples out there.
Let's focus on the Menu. Here's the relevant XAML:
<Window.Resources>
<XmlDataProvider x:Key="xmlData">
<x:XData>
<items>
<item Name="file" />
<item Name="edit" />
<item Name="debug" />
</items>
</x:XData>
</XmlDataProvider>
...
<Window.Resources>
<Grid Background="#FFA1C4A1">
<Menu Foreground="Blue" Height="24" HorizontalAlignment="Left" Margin="291,106,0,0" Name="menu1" VerticalAlignment="Top" Width="200" ItemsSource="{Binding Source={StaticResource xmlData}, XPath=items/item/@Name}" Background="#FFEF1818" />
...
What am I doing wrong?
Upvotes: 1
Views: 203
Reputation: 735
You need to add xmlns="" to your list of item.
Instead of
<items>
use
<items xmlns="">
Upvotes: 4