C1Book コントロールにテンプレートとコードを追加しました。この手順ではアプリケーションにいくつかのファイルを追加します。これらのコンテンツファイルは、データを表示するためにコードから呼び出されます。
XAML でマークアップの書き方
マークアップ |
コードのコピー
|
---|---|
<books> <book id="0672328917" coverUri="http://www.coverbrowser.com/image/bestsellers-2007/1943-1.jpg" price="$49.99" title="Windows Presentation Foundation Unleashed (WPF) (Unleashed)" stockAmount="1" /> <!-- <book id="073562528X" coverUri="http://borntolearn1.mslearn.net/images/2009/06/9780735625730f.jpg" price="$34.99" title="Introducing Microsoft Silverlight 3.0" stockAmount="200" /> <book id="0596510373" coverUri="http://ecx.images-amazon.com/images/I/51DF0boY5fL.jpg" price="$49.99" title="Programming WPF" stockAmount="30" /> --> <book id="0596527438" coverUri="http://www.coverbrowser.com/image/oreilly-books/97-1.jpg" price="$49.99" title="Programming C# 3.0 (Programming)" stockAmount="5" /> <book id="0596519982" coverUri="http://ecx.images-amazon.com/images/I/51U9eZeXhuL._SL500_.jpg" price="$34.99" title="Essential Silverlight 2 Up-to-Date (Up-To-Date)" stockAmount="8" /> <book id="1590599594" coverUri="http://ecx.images-amazon.com/images/I/51DedRUoZGL.jpg" price="$44.99" title="Beginning Web Development, Silverlight, and ASP.NET AJAX: From Novice to Professional (Beginning from Novice to Professional)" stockAmount="178" /> <book id="059651509X" coverUri="http://www.coverbrowser.com/image/oreilly-books/30-1.jpg" price="$44.99" title="Painting the Web" stockAmount="1" /> <book id="0672330075" coverUri="http://vig-fp.pearsoned.co.uk/bigcovers/0672330075.jpg" price="$39.99" title="Silverlight 1.0 Unleashed" stockAmount="1" /> <book id="0672329689" coverUri="http://images.pearsoned-ema.com/jpeg/large/9780672329685.jpg" price="$34.99" title="Creating Vista Gadgets: Using HTML, CSS and JavaScript with Examples in RSS, Ajax, ActiveX (COM) and Silverlight" stockAmount="1" /> <book id="1590599764" coverUri="http://knowfree.net/wp-content/uploads/2008/05/159059976401l-250x299.jpg" price="$39.99" title="Foundation Expression Blend 2: Building Applications in WPF and Silverlight (Foundation)" stockAmount="13" /> <!-- <book id="1590599497" coverUri="http://i39.tinypic.com/dqhnoi.jpg" price="$44.99" title="Pro Silverlight 2 in C# 2008 (Windows.Net)" stockAmount="1" /> <book id="159059939X" coverUri="http://www.sql163.com/UploadFile/Book_Image/2009-3/Sql163_2009329192012.jpg" price="$14.99" title="Silverlight and ASP.NET Revealed" stockAmount="1" /> --> </books> |
C# コードの書き方
C# |
コードのコピー
|
---|---|
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Input; namespace BookTest { public class AmazonBookDescription { public string Title { get; set; } public string CoverUri { get; set; } public string Id { get; set; } public string Price { get; set; } public int StockAmount { get; set; } } } |
この手順では、2つのファイルをアプリケーションに追加しました。次の手順では、このアプリケーションを実行します。