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:local="clr-namespace:SilverlightApplication3" >
Margin="0,0,5,0" />
Margin="0,0,5,0"/>
//File: Page.xaml.cs
using System.Windows.Controls;
using System.Windows.Data;
using System.Collections.Generic;
namespace SilverlightApplication3
{
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public long PhoneNum { get; set; }
}
public class Company
{
public string Name { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public int ZipCode { get; set; }
public List Employees { get; set; }
public Company()
{
this.Name = "A";
this.Street = "5l Street";
this.City = "New York";
this.State = "NY";
this.ZipCode = 10005;
this.Employees = new List();
this.Employees.Add(
new Employee
{
FirstName = "A",
LastName = "B",
PhoneNum = 2
});
this.Employees.Add(
new Employee
{
FirstName = "C",
LastName = "D",
PhoneNum = 7
});
}
}
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
Binding CompanyNameBinding = new Binding("Name");
CompanyNameBinding.Mode = BindingMode.OneWay;
tbxCompanyName.SetBinding(TextBlock.TextProperty,CompanyNameBinding);
}
}
}