XMAL代碼
<Window x:Class=
xmlns=
xmlns:x=
Title=
<StackPanel Background=
<ListView x:Name=
<ListView
<GridView>
<!
<GridViewColumn Header=
<GridViewColumn Header=
</GridView>
</ListView
</ListView>
</StackPanel>
</Window>
CS代碼
namespace 使用XML數據作為Binding的源
{
/// <summary>
/// MainWindow
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent()
//從指定的路徑加載XML文檔
XmlDocument doc = new XmlDocument()
doc
//設置用於做綁定源的XML
XmlDataProvider xdp = new XmlDataProvider()
xdp
xdp
this
this
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/13409.html