WPF C# Tutorial

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:c="clr-namespace:DataTriggerSample"
  Title="DataTriggerSample" Height="300" Width="300">
  
    
    
      
        
          
        
        
          
        
        
          
            
            
          

          
            
          

        

      

    
    
      
        
        
      
    
  

  
    Data Trigger Sample
    
  


//File:Window.xaml.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
namespace DataTriggerSample
{
    public partial class Window1 : System.Windows.Window
    {
        public Window1()
        {
            InitializeComponent();
        }
    }
    public class Person
    {
        private string _name;
        private string _relationshipType;
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        public string RelationshipType
        {
            get { return _relationshipType; }
            set { _relationshipType = value; }
        }
        public Person(string name, string relationshiptype)
        {
            this._name = name;
            this._relationshipType = relationshiptype;
        }
    }
    public class People : ObservableCollection
    {
        public People()
        {
            Add(new Person("A", "Friend"));
            Add(new Person("C", "Family"));
            Add(new Person("B", "Friend"));
        }
    }
}