Creating a C1TimeSelector Control in Code
In This Topic
This topic will walk you through creating a C1TimeSelector control and applying some basic styling to the control via code.
Follow these steps:
- Open MainPage.xaml if it isn't already open and locate the <Grid> </Grid> tag set. Edit the markup so that it resembles the following markup:
Markup |
Copy Code
|
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" x:Name="LayoutRoot">
</Grid>
|
- Right-click your page and select View Code from the list to switch to code view.
- Add the following namespaces to your application
C# |
Copy Code
|
using C1.Xaml;
|
Visual Basic |
Copy Code
|
Imports C1.Xaml
|
- Insert the following constructor directly below the InitializeComponent() method:
C# |
Copy Code
|
C1TimeSelector c1timeselect1 = new C1TimeSelector();
|
Visual Basic |
Copy Code
|
Dim c1timeselect1 As C1TimeSelector = New C1TimeSelector
|
- Add the following code below the constructor to control the width and height of the C1TimeSelector:
C# |
Copy Code
|
c1timeselect1.Height = 55;
c1timeselect1.Width = 350;
|
Visual Basic |
Copy Code
|
c1timeselect1.Height = 55
c1timeselect1.Width = 350
|
- Insert the final line of code to display the C1TimeSelector:
C# |
Copy Code
|
LayoutRoot.Children.Add(c1timeselect1);
|
Visual Basic |
Copy Code
|
LayoutRoot.Children.Add(c1timeselect1)
|
- Run your application. The C1TimeSelector control should resemble the following image:
See Also