I have vb code along with xml.and i need to populate simple xml file in list box in silverlight appliction ,but its not rendering any thing
Code:
<UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Background="White">
<ListBox x:Name="customersList" Width="400" Height="200" />
</Grid>
</UserControl>
Code:
Private Sub PopulateCustomersList()
Dim settings As New XmlReaderSettings()
settings.XmlResolver = New XmlXapResolver()
Dim reader As XmlReader = XmlReader.Create("Customers.xml")
reader.MoveToContent()
While reader.Read()
If reader.NodeType = XmlNodeType.Element AndAlso reader.Name = "customer" Then
customersList.Items.Add(New ListBoxItem())
End If
If reader.NodeType = XmlNodeType.EndElement AndAlso reader.Name = "customers" Then
Exit While
End If
End While
reader.Close()
End Sub
Code:
Private Sub Btn_hello_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
MessageBox.Show("Hello World")
PopulateCustomersList()
End Sub