我想在silverlight数据网格中显示xml文件数据。即时通讯使用下面的代码,但它does not工作。请帮助。在silverlight datagrid中显示xml数据,vb.net
我的vb.net代码:
进口系统 进口System.Collections.Generic 进口System.Linq的 进口System.Windows 进口System.Windows.Controls 进口System.Xml.Linq的
命名空间SilverlightApplication1 公共部分分类页面 Inherits UserControl Public Sub New() InitializeComponent() End Sub
Private Sub Page_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
DataGrid1.ItemsSource = GetReport()
End Sub
Public Function GetStatusReport() As List(Of Table)
Dim statusReport As New List(Of Table)()
Dim doc As XElement = XElement.Load("Data/Report.xml")
report = (From row In doc.Elements() _
Select GetStatus(row)).ToList()
Return statusReport
End Function
Private Function GetReport(ByVal row As XElement) As Table
Dim s As New Table()
s.JobID= row.Attribute("ID").Value
s.VenueName= row.Attribute("Name").Value)
Return s
End Function
End Class
末命名空间