Book.cs using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace SilverlightApplication4 { public class Book { public string ISBN { get; set; } public string Title { get; set; } public DateTime PublishDate { get; set; } public double Price { get; set; } public Book(string _isbn,string _title,DateTime _publishdate,double _price) { this.ISBN = _isbn; this.Title = _title; this.PublishDate = _publishdate; this.Price = _price; } } } MainPage.xaml Code: <UserControl x:Class="SilverlightApplication4.MainPage" 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"> <StackPanel Margin="50"> <ListBox ItemsSource="{Binding Mode=OneWay}" x:Name="MyBook"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding ISBN}" Margin="0,0,50,0"></TextBlock> <TextBlock Text="{Binding Title}" Margin="0,0,50,0"></TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Rectangle Fill="Gray" Height="2" HorizontalAlignment="Left"></Rectangle> <StackPanel x:Name="BookDetail"> <TextBlock Text="{Binding ISBN, Mode=OneWay}"></TextBlock> <TextBlock Text="{Binding Title, Mode=OneWay}"></TextBlock> <TextBlock Text="{Binding PublishDate, Mode=OneWay}"></TextBlock> <TextBlock Text="{Binding Price, Mode=OneWay}"></TextBlock> </StackPanel> </StackPanel> </UserControl> MainPage.xaml.cs Code: using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Collections.ObjectModel; namespace SilverlightApplication4 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); AllBook.Add(new Book("8123198921", "孔夫子", new DateTime(2010, 01, 12), 30)); AllBook.Add(new Book("8123123232", "红楼梦——新版", new DateTime(2009, 08, 23), 88)); AllBook.Add(new Book("8123123512", "阿凡达", new DateTime(2010, 01, 04), 120)); this.MyBook.DataContext = AllBook; this.MyBook.SelectionChanged += new SelectionChangedEventHandler(MyBook_SelectionChanged); this.MyBook.SelectedIndex = 0; } void MyBook_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox lsbookdetails = sender as ListBox; this.BookDetail.DataContext = lsbookdetails.SelectedItem; } private ObservableCollection<Book> _AllBook; public ObservableCollection<Book> AllBook { get { if (_AllBook == null) { _AllBook = new ObservableCollection<Book>(); AllBook.Add(new Book("8123123131", "哈利波特与凤凰社", new DateTime(2009, 10, 01), 42)); } return _AllBook; } } } } 参考:CHS_Silverlight_3