WPF VB.Net Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="TreeViewDataBinding"
    xmlns:EngNews="clr-namespace:TreeViewDataBinding">
  
    
    
    
      
        
        
      

    
    
      
        
        
          test
        
      

    
    
      
        
        Eastern Hemisphere
      

    
  

  
      
                              ItemsSource="{Binding Source={StaticResource WesternHemisphereDataSource}}"
                      ItemTemplate="{StaticResource NewspaperTVItem}"/>
                              ItemsSource="{Binding Source={StaticResource EasternHemisphereDataSource}}"
                      ItemTemplate="{StaticResource NewspaperTVItem}"/>
      
    
  


//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Shapes
Imports System.Collections.ObjectModel
Namespace TreeViewDataBinding
  Public Partial Class Window1
    Inherits Window
    Public Sub New()
      InitializeComponent()
    End Sub
    Private Sub SelectedNewspaperChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of [Object]))
      Dim engnews As WebSiteEntry = TryCast(WebSiteEntrys.SelectedItem, WebSiteEntry)
      If engnews IsNot Nothing Then
        NewspaperFrame.Navigate(New System.Uri(engnews.Website))
      End If
    End Sub
  End Class
  Public Class WebSiteEntry
    Private _name As String
    Private _website As String
    Public Property Website() As String
      Get
        Return _website
      End Get
      Set
        _website = value
      End Set
    End Property
    Public Property Name() As String
      Get
        Return _name
      End Get
      Set
        _name = value
      End Set
    End Property
    Public Sub New(name__1 As String, website__2 As String)
      Name = name__1
      Website = website__2
    End Sub
  End Class
  Public Class WebSiteGroupA
    Inherits ObservableCollection(Of WebSiteEntry)
    Public Sub New()
      Add(New WebSiteEntry("A", "http://www.A.com"))
      Add(New WebSiteEntry("B", "http://www.B.com"))
      Add(New WebSiteEntry("C", "http://www.C.com"))
    End Sub
  End Class
  Public Class WebSiteGroupB
    Inherits ObservableCollection(Of WebSiteEntry)
    Public Sub New()
      Add(New WebSiteEntry("D", "http://www.D.com/"))
      Add(New WebSiteEntry("E", "http://www.E.net/"))
      Add(New WebSiteEntry("F", "http://www.F.com"))
    End Sub
  End Class
End Namespace