WPF C# 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.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
namespace TreeViewDataBinding
{
    public partial class Window1 : Window{
        public Window1(){
            InitializeComponent();
        }
        private void SelectedNewspaperChanged(object sender,RoutedPropertyChangedEventArgs e){
            WebSiteEntry engnews = WebSiteEntrys.SelectedItem as WebSiteEntry;
            if( engnews != null ) NewspaperFrame.Navigate(new System.Uri(engnews.Website));
        }
    }
    public class WebSiteEntry{
        private string _name;
        private string _website;
        public string Website
        {
            get { return _website; }
            set { _website = value; }
        }
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        public WebSiteEntry(string name, string website)
        {
            Name = name;
            Website = website;
        }
    }
    public class WebSiteGroupA : ObservableCollection
    {
        public WebSiteGroupA()
        {
            Add(new WebSiteEntry("A","http://www.A.com"));
            Add(new WebSiteEntry("B","http://www.B.com"));
            Add(new WebSiteEntry("C","http://www.C.com"));
        }
    }
    public class WebSiteGroupB : ObservableCollection
    {
        public WebSiteGroupB()
        {
            Add(new WebSiteEntry("D","http://www.D.com/"));
            Add(new WebSiteEntry("E","http://www.E.net/"));
            Add(new WebSiteEntry("F","http://www.F.com"));
        }
    }
}