ComponentOne Sparkline for UWP
Step 1 of 3: Creating the Application
Sparkline for UWP Quick Start > Step 1 of 3: Creating the Application

In this step you'll create a new Windows application in Visual Studio and add the C1Sparkline control to a page.

  1. In Visual Studio, select File | New | Project.
  2. In the New Project dialog box:
    1. Select Templates | Visual C# | Windows | Universal. From the templates list, select Blank App (Universal Windows).
    2. Enter a Name and click OK to create your project.
  3. Right-click the References folder in the Solution Explorer and select Add Reference from the dropdown list.
  4. Expand Universal Windows and select Extensions; you should see the UWP Assemblies in the center pane.
  5. Check the C1.UWP and C1.UWP.Sparkline references and click OK.
  6. Add the following markup to the opening <Page> tag:
    Markup
    Copy Code
    xmlns:c1="using:C1.Xaml.Sparkline"
    

    The <Page> tag should resemble the following:

    Markup
    Copy Code
    <Page
    x:Class="App2.MainPage"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:local="using:App2"
       xmlns:c1="using:C1.Xaml.Sparkline"
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
       mc:Ignorable="d">
    
  7. Place your cursor between the <Grid></Grid> tags.
  8. Locate the C1Sparkline control in the Visual Studio ToolBox. Double-click the control to add it to your application.
  9. Edit the <c1:C1Sparkline/> tag so that it resembles the following sample. This will add a name so that the control can be called in code, add some color customization to the sparkline control, and will add the appropriate binding statements:
    Markup
    Copy Code
    <c1:C1Sparkline x:Name="sparkline" Width="100" Height="100" Data="{Binding Data}" DateAxisData="{Binding DateAxis}" SeriesColor="#FF4BC128" ShowMarkers="True"/>
    

What You’ve Accomplished

In this step, you created a new Windows Store application, added the appropriate assembly references to the application, and added a C1Sparkline control.

See Also