x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WpfApplication1="clr-namespace:WpfApplication1"
Title="WPF" Height="300" Width="300">
Style="{StaticResource lblStyle}"
Text="First Name" />
Style="{StaticResource dataStyle}"
Text="{Binding Path=FirstName}"/>
Style="{StaticResource lblStyle}"
Text="Age" />
Style="{StaticResource dataStyle}"
Text="{Binding Path=Age}" />
Margin="4"
Grid.Column="1"
Width="96"
Height="140"
Source="{Binding Path=Photo}"/>
ItemsSource="{Binding Source={StaticResource people}}"
ItemTemplate="{StaticResource personTemplate}"/>
//File:Window.xaml.cs
using System.Collections.ObjectModel;
namespace WpfApplication1
{
public class Employee
{
public string FirstName
{
get;
set;
}
public int Age
{
get;
set;
}
public string Photo
{
get;
set;
}
public override string ToString()
{
return FirstName;
}
}
public class People : Collection
{
public People()
{
this.Add(new Employee()
{
FirstName = "A",
Age = 26,
Photo = "a.png"
});
this.Add(new Employee()
{
FirstName = "C",
Age = 24,
Photo = "c.png"
});
}
}
}