3
큰 문제가 있습니다. 복사 된 예제에서도 기본 데이터 바인딩을 사용할 수 없습니다. 디자이너에서는 목록 상자에 2 개의 항목이 있지만 런타임에는 비어 있습니다.WPF ListBox 데이터 바인딩은 Designer에서는 작동하지만 런타임에는 작동하지 않습니다.
<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>
VS/Framework의 버전은 무엇입니까? –