Display xml data in silverlight datagrid, vb.net
        Posted  
        
            by Aishwarya
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Aishwarya
        
        
        
        Published on 2010-05-12T15:50:31Z
        Indexed on 
            2010/05/12
            15:54 UTC
        
        
        Read the original article
        Hit count: 270
        
Silverlight
|3.0
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
© Stack Overflow or respective owner