Display xml data in silverlight datagrid, vb.net
- by Aishwarya
I want to display an xml file data in silverlight datagrid. im using the below code but it doesnt work.Please help.
My vb.net code:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Windows
Imports System.Windows.Controls
Imports System.Xml.Linq
Namespace SilverlightApplication1
Public Partial Class Page
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
Private Sub Page_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
DataGrid1.ItemsSource = GetPunchReport()
End Sub
Public Function GetStatusReport() As List(Of Table)
Dim statusReport As New List(Of Table)()
Dim doc As XElement = XElement.Load("Data/PunchReport.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("JobID").Value
s.VenueName= row.Attribute("VenueName").Value)
Return s
End Function
End Class
End Namespace