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">
HorizontalAlignment="Center">Data Trigger Sample
ItemsSource="{Binding Source={StaticResource PeopleData}}"/>
//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;
public string Name
{
get { return _name; }
set { _name = value; }
}
public Person(string name)
{
this._name = name;
}
}
public class People : ObservableCollection
{
public People()
{
Add(new Person("A"));
Add(new Person("B"));
Add(new Person("C"));
}
}
}