WPF ListBox数据绑定在设计器中工作,但在运行时不工作
我有一个令人恼火的问题——我无法让基本数据绑定工作,即使是复制的示例。在设计器中,列表框有2个项,但在运行时为空WPF ListBox数据绑定在设计器中工作,但在运行时不工作,wpf,data-binding,xaml,Wpf,Data Binding,Xaml,我有一个令人恼火的问题——我无法让基本数据绑定工作,即使是复制的示例。在设计器中,列表框有2个项,但在运行时为空 <Window x:Class="BasicTables" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="BasicTables" Height=
<Window x:Class="BasicTables"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BasicTables" Height="300" Width="300">
<Window.Resources>
<XmlDataProvider x:Key="data" XPath="/pages">
<x:XData>
<pages>
<page>
<id>1</id>
<name>Hello World</name>
</page>
<page>
<id>2</id>
<name>Hello World2</name>
</page>
</pages>
</x:XData>
</XmlDataProvider>
</Window.Resources>
<Grid>
<ListBox Name="ListBox1">
<ListBox.ItemsSource>
<Binding Source="{StaticResource data}" XPath="page"/>
</ListBox.ItemsSource>
</ListBox>
</Grid>
</Window>
1.
你好,世界
2.
你好,世界2
天哪,我讨厌XML名称空间
<pages xmlns="">
VS/Framework的哪个版本?