ComponentOne Basic Library for UWP
Basic Library Overview / Input for UWP / Input for UWP Quick Starts / NumericBox for UWP Quick Start / Step 1 of 4: Creating an Application with NumericBox Control
In This Topic
    Step 1 of 4: Creating an Application with NumericBox Control
    In This Topic

    In this step you'll create a UWP-style application using NumericBox for UWP. When you add a C1NumericBox control to your application, you'll have a complete, functional numeric editor. You can further customize the control to your application.

    To set up your project, complete the following steps:

    1. Select File | New | Project.
    1. In the New Project dialog box, select Templates | Visual C# | Windows | Universal. From the templates list, select Blank App (Universal Windows). Enter a Name and click OK to create your project.
    1. Open MainPage.xaml if it isn't already open, place the cursor between the <Grid> and </Grid> tags, and click once.
    1. Navigate to the Toolbox and double-click the StackPanel icon to add the panel to MainPage.xaml.
    1. Add x:Name="sp1" Width="Auto" Height="Auto" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" to the <StackPanel> tag so that it appears similar to the following:
    Markup
    Copy Code
    <StackPanel x:Name="sp1" Width="Auto" Height="Auto" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"></StackPanel>
    

    Elements in the panel will now appear centered and vertically positioned.

    1. In the XAML window of the project, place the cursor between the <StackPanel> and </StackPanel> tags.
    1. Navigate to the Visual Studio Toolbox and double-click the standard TextBlock control to it to your project.
    1. Name the TextBlock and add content to it by adding x:Name="tb1" Text="Enter Combination" Margin="5" FontSize="24" to the <TextBlock> tag so that it appears similar to the following:
    Markup
    Copy Code
    <TextBlock x:Name="tb1" Text="Enter Combination" Margin="5" FontSize="24"/>
    
    1. Navigate to the Toolbox and double-click the StackPanel icon to add the panel to the existing StackPanel just below the TextBlock.
    1. Add x:Name="sp2" Width="Auto" Height="Auto" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" to the <StackPanel> tag so that it appears similar to the following:
    Markup
    Copy Code
    <StackPanel x:Name="sp2" Width="Auto" Height="Auto" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"></StackPanel>
    

    Elements in the panel will now appear centered and horizontally positioned.

    1. Place the cursor between the first </StackPanel> tag and the second </StackPanel> tag and add the following markup to create a second label:
    Markup
    Copy Code
    <TextBlock x:Name="tb2" Text="Invalid Combination" Foreground="Red" Margin="5" FontSize="18"/>
    
    1. Place the cursor between the <TextBlock> tag and the second </StackPanel> tag and add the following markup to create a hidden button:
    Markup
    Copy Code
    <Button x:Name="btn1" Content="Enter" Height="60" Visibility="Collapsed" Click="btn1_Click" Margin="5"></Button>
    

    You will add the btn1_Click event handler later in code.

    You've successfully created a UWP-style application, set up the application's user interface, and added controls to the application. In the next step you'll add C1NumericBox controls and complete setting up the application.

    See Also