Extended Library for UWP | ComponentOne
Extended Library Overview / Book for UWP / Book for UWP Quick Start / Step 3 of 4: Adding Files to the Application
In This Topic
    Step 3 of 4: Adding Files to the Application
    In This Topic

    You've added templates and some code to the C1Book control. In this step, you'll add files to the application. These content files are the ones that the code calls in order to display the data.

    1. Right-click your project name and select Add | New Item from the menu.
    2. In the Add New Item window, select XML File. Name the file Amazon.xml. The file should open automatically.
    3. Add the following markup to the Amazon.xml file:
    Markup
    Copy Code
    <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>
    
    1. Right-click your project name again and select Add | New Item from the list. When the Add New Item window opens, choose Code File and name it AmazonBookDescription.cs.
    1. The new code file should open automatically. Add the following code to the file:
    C#
    Copy Code
    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; }
        }
    }
    

    In this step, you added two files to your application. In the next step, you will run your application.

    See Also