xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
xmlns:d='http://schemas.microsoft.com/expression/blend/2008'
xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'
mc:Ignorable='d'
d:DesignWidth='640'
d:DesignHeight='480'
xmlns:datacontrols="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
RadiusY="3" Stroke="#FF686868" StrokeThickness="0"
Width="Auto">
Stroke="#FF0A28EE" Grid.RowSpan="1"
StrokeThickness="5" VerticalAlignment="Stretch"/>
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ItemTemplate="{StaticResource dtEmployee}"
/>
//File: Page.xaml.cs
using System.Collections.Generic;
using System.Windows.Controls;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
List EmployeeList = new List();
EmployeeList.Add(new Employee
{
FirstName = "A",
LastName = "B",
PhoneNum = 2,
Address = new Address { Street = "2 Street", City = "New York", State = "NY", ZipCode = 10006 }
});
EmployeeList.Add(new Employee{
FirstName = "C",
LastName = "D",
PhoneNum = 7,
Address = new Address { Street = "1 Road", City = "New York", State = "NY", ZipCode = 10016 }
});
cntctrlEmployee.Content = EmployeeList[0];
itmctrlEmployees.ItemsSource = EmployeeList;
}
}
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public long PhoneNum { get; set; }
public string ImageUri
{
get
{
return "/" + FirstName + ".png";
}
}
public Address Address { get; set; }
}
public class Address
{
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public int ZipCode { get; set; }
}
}