Tag Archives: Tutorial


Windows 10 – Universal Windows Platform – Groove
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once done start your favourite Web Browser such as Microsoft Edge and navigate to azure.microsoft.com/marketplace and search for Microsoft Groove API
Step 3
Select Microsoft Groove API Data Service, then tap on Sign Up, then on Microsoft Groove API data details page tap the Sign up button on that page
Step 4
You will be prompted to Sign in with your Microsoft Account details, if you don’t have one can sign up for one during this process, once done View Publisher Offer Terms and View Publisher Privacy Policy then if Agree to the Terms and Privacy Policy then confirm by selecting Sign Up
Step 5
Once done select My Account then Developers then Register. Then on the Register your application page enter a unique Client ID you will need this later, also enter a Name, then select and copy the Client secret as you will also need this later, then enter the Redirect URI as http://www.example.org and then enter a Description and then select Create
Step 6
This will add that to the Registered Applications which completes the process for signing up for Microsoft Groove API, so return to Visual Studio Community 2015
Step 7
Return to or start Visual Studio Community 2015 then select File, then New, then Project… from the Menu.
Step 8
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in a Name and select a Location to save to before selecting Ok to create the Project.
Step 9
Once done select from the Menu, Project, then Add New Item…
Step 10
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as Library.cs before selecting Add to add the file to the Project
Step 11
Once in the Code View for Library.cs the following should be entered:
using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.UI.Xaml.Controls; using Windows.Web.Http; public class Item { public string Link { get; set; } public string Name { get; set; } public string ImageUrl { get; set; } public string SmallImageUrl { get { return ImageUrl != null ? ImageUrl + "&w=64&h=64" : ImageUrl; } } } public class Tracks { public List<Item> Items { get; set; } } public class Browse { public Tracks Tracks { get; set; } } public class Library { private const string clientId = "ClientID"; private const string clientSecret = "ClientSecret"; private const string service = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13"; private const string uri = "https://music.xboxlive.com//1/content/music/catalog/tracks/browse"; private const string param = "?orderBy=MostPopular&maxitems=10&accessToken=Bearer+"; private const string scope = "http://music.xboxlive.com"; private const string grant = "client_credentials"; private const string regex = ".*\"access_token\":\"(.*?)\".*"; private HttpClient client = new HttpClient(); private HttpResponseMessage response = new HttpResponseMessage(); private Browse browse = new Browse(); private async Task<string> token() { Dictionary<string, string> request = new Dictionary<string, string>() { {"client_id", clientId }, {"client_secret", clientSecret }, { "scope", scope }, { "grant_type", grant } }; response = await client.PostAsync(new Uri(service), new HttpFormUrlEncodedContent(request)); return System.Net.WebUtility.UrlEncode( Regex.Match(await response.Content.ReadAsStringAsync(), regex, RegexOptions.IgnoreCase).Groups[1].Value); } public async void Init(ListView display) { response = await client.GetAsync(new Uri(uri + param + await token())); byte[] json = Encoding.Unicode.GetBytes(await response.Content.ReadAsStringAsync()); using (MemoryStream stream = new MemoryStream(json)) { browse = (Browse)new DataContractJsonSerializer(typeof(Browse)).ReadObject(stream); } display.ItemsSource = browse?.Tracks?.Items; } }
While still in the Code View for Library.cs change “ClientID” to be the ClientId from the Azure Marketplace e.g. “GrooveTutorial” and change “ClientSecret” to be the Client Secret that was generated, similar to e.g. R3Jvb3ZlVHV0b3JpYWxDbGllbnRTZWNyZXQ=, it should then appear as such:
Step 12
From the Solution Explorer select MainPage.xaml
Step 13
Select from the Menu, View then Designer
Step 14
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<ListView Name="Display"> <ListView.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Margin="10" Height="64" Width="64" Source="{Binding SmallImageUrl}"/> <HyperlinkButton Content="{Binding Name}" NavigateUri="{Binding Link}" VerticalAlignment="Center"/> </StackPanel> </DataTemplate> </ListView.ItemTemplate> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> </Style> </ListView.ItemContainerStyle> </ListView>
It should appear as such:
Step 15
Select from the Menu, View then Code
Step 16
Once in the Code View below the public MainPage() { … } the following should be entered:
public Library Library = new Library(); protected override void OnNavigatedTo(NavigationEventArgs e) { Library.Init(Display); }
It should then appear as such:
Step 17
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 18
Once the Simulator has started the Application should then appear showing the Top 10 most played tracks on Groove Music in the Application
Step 19
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 20
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 21
Once the Emulator has started the Application should then appear showing the Top 10 most played tracks on Groove Music in the Application
Step 22
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Toast Input
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in a Name and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as Library.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for Library.cs the following should be entered:
using System; using System.Text; using Windows.UI.Notifications; using Windows.Data.Xml.Dom; public class Library { private Random random = new Random((int)DateTime.Now.Ticks); public void Schedule(DateTime when) { StringBuilder template = new StringBuilder(); template.Append("<toast><visual version='2'><binding template='ToastText02'>"); template.AppendFormat("<text id='2'>Enter Message:</text>"); template.Append("</binding></visual><actions>"); template.Append("<input id='message' type='text'/>"); template.Append("<action activationType='foreground' content='ok' arguments='ok'/>"); template.Append("</actions></toast>"); XmlDocument xml = new XmlDocument(); xml.LoadXml(template.ToString()); ScheduledToastNotification toast = new ScheduledToastNotification(xml, when); toast.Id = random.Next(1, 100000000).ToString(); ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); } }
It should then appear as such:
Step 7
From the Solution Explorer select App.xaml
Step 8
Select from the Menu, View then Code
Step 9
Once in the Code View for App.xaml.cs the following event handler should be entered below private void OnSuspending(object sender, SuspendingEventArgs e) { … }:
protected async override void OnActivated(IActivatedEventArgs e) { base.OnActivated(e); try { if (e.Kind == ActivationKind.ToastNotification) { ToastNotificationActivatedEventArgs toastArgs = (ToastNotificationActivatedEventArgs)e; await new Windows.UI.Popups.MessageDialog((string)toastArgs.UserInput["message"]).ShowAsync(); } } catch { } }
It should then appear as such:
Step 10
From the Solution Explorer select MainPage.xaml
Step 11
Select from the Menu, View then Designer
Step 12
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Button Content="Display" Click="Button_Click" HorizontalAlignment="Center"/>
It should appear as such:
Step 13
Select from the Menu, View then Code
Step 14
Once in the Code View below the public MainPage() { … } the following should be entered:
public Library Library = new Library(); private void Button_Click(object sender, RoutedEventArgs e) { Library.Schedule(DateTime.Now + TimeSpan.FromMinutes(1)); }
It should then appear as such:
Step 15
That completes the Universal Windows Application so Save the Project then select the Debug and Local Machine option to run the Application
Step 16
Once the Local Machine has started the Application should then appear
Step 17
After the Application has started running you can then tap Display then after a minute a Toast Notification will be displayed that can be used to enter text to show message in the Application
Step 18
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 19
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 20
Once the Emulator has started the Application should then appear
Step 21
After the Application has started running you can then tap Display then after a minute a Toast Notification will be displayed that can be used to enter text to show message in the Application
Step 22
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Tile Output
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in a Name and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as Library.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for Library.cs the following should be entered:
using System; using System.Linq; using System.Text; using Windows.Data.Xml.Dom; using Windows.UI.Notifications; using Windows.UI.Xaml.Controls; public class Item { public string Id { get; set; } public string Content { get; set; } public string Time { get; set; } } public class Library { private Random random = new Random((int)DateTime.Now.Ticks); public void Add(ref ListBox display, string value, TimeSpan occurs) { DateTime when = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, occurs.Hours, occurs.Minutes, occurs.Seconds); if (when > DateTime.Now) { StringBuilder template = new StringBuilder(); template.Append("<tile><visual version=\"4\">"); template.Append("<binding template=\"TileSquare150x150Text03\">"); template.AppendFormat("<text id=\"1\">{0}</text>", value); template.AppendFormat("<text id=\"2\">{0}</text>", when.ToLocalTime().ToString("HH:mm")); template.Append("</binding></visual></tile>"); XmlDocument xml = new XmlDocument(); xml.LoadXml(template.ToString()); ScheduledTileNotification tile = new ScheduledTileNotification(xml, when); tile.Id = random.Next(1, 100000000).ToString(); TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(tile); display.Items.Add(new Item { Id = tile.Id, Content = value, Time = when.ToString() }); } } public void Remove(ListBox display) { if (display.SelectedIndex > -1) { TileUpdateManager.CreateTileUpdaterForApplication().GetScheduledTileNotifications().Where( p => p.Id.Equals(((Item)display.SelectedItem).Id)).SingleOrDefault(); display.Items.RemoveAt(display.SelectedIndex); } } }
It should then appear as such:
Step 7
From the Solution Explorer select MainPage.xaml
Step 8
Select from the Menu, View then Designer
Step 9
The Design View will be displayed along with the XAML View and in this above <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Page.BottomAppBar> <AppBar IsOpen="True" IsSticky="True"> <StackPanel Orientation="Horizontal"> <AppBarButton Name="Add" Icon="Add" Label="Add" Click="Add_Click"/> <AppBarButton Name="Remove" Icon="Remove" Label="Remove" Click="Remove_Click"/> </StackPanel> </AppBar> </Page.BottomAppBar>
While still in the XAML View below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackPanel Grid.Row="0"> <TextBox Margin="10" HorizontalAlignment="Stretch" Name="Value"/> <TimePicker Margin="10" HorizontalAlignment="Stretch" Name="Occurs"/> </StackPanel> <ListBox Name="Display" Grid.Row="1"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock TextWrapping="Wrap" Text="{Binding Path=Content}"/> <TextBlock Text="{Binding Path=Time}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid>
It should appear as such:
Step 10
Select from the Menu, View then Code
Step 11
Once in the Code View below the public MainPage() { … } the following should be entered:
public Library Library = new Library(); private void Add_Click(object sender, RoutedEventArgs e) { Library.Add(ref Display, Value.Text, Occurs.Time); } private void Remove_Click(object sender, RoutedEventArgs e) { Library.Remove(Display); }
It should then appear as such:
Step 12
That completes the Universal Windows Application so Save the Project then select the Debug and Local Machine option to run the Application
Step 13
Once the Local Machine has started the Application should then appear
Step 14
After the Application has started you can then type some text then select a Time, then select Add to schedule a Tile Notification for that Time with the Text selected, then select the Start button to show the Start Menu then find the app under “Recently Added” then tap and hold or right-click and select Pin to Start then once done wait for the Notification to appear at the time selected on the Tile for the Application
Step 15
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 16
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 17
Once the Emulator has started the Application should then appear
Step 18
After the Application has started you can then type some text then select a Time, then select Add to schedule a Tile Notification for that Time with the Text selected, then select the Start button and choose All apps then find the app under “Recently Added” then tap and hold or right-click and select Pin to Start then once done wait for the Notification to appear at the time selected on the Tile for the Application
Step 19
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Cortana
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in a Name and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as Library.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for Library.cs the following should be entered:
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using Windows.ApplicationModel; using Windows.Storage; using Windows.UI; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Shapes; public static class Library { private static IEnumerable<string> splitCapital(string text) { Regex regex = new Regex(@"\p{Lu}\p{Ll}*"); foreach (Match match in regex.Matches(text)) { yield return match.Value; } } private static Dictionary<string, Color> colours = typeof(Colors) .GetRuntimeProperties() .Select(c => new { Color = (Color)c.GetValue(null), Name = string.Join(" ", splitCapital(c.Name)) }).ToDictionary(x => x.Name, x => x.Color); public static string Command { get; set; } public static async void Parse(TextBlock title, Rectangle display) { try { StorageFile file = await Package.Current.InstalledLocation.GetFileAsync(@"VCD.xml"); await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(file); } catch { } if (!string.IsNullOrEmpty(Command)) { string titleCase = Regex.Replace(Command.ToLower(), @"(^\w)|(\s\w)", m => m.Value.ToUpper()); if (colours.Any(a => a.Key == titleCase)) { KeyValuePair<string, Color> value = colours.Where(w => w.Key == titleCase).FirstOrDefault(); title.Text = value.Key; display.Fill = new SolidColorBrush(value.Value); } } } }
It should then appear as such:
Step 7
From the Solution Explorer select App.xaml
Step 8
Select from the Menu, View then Code
Step 9
Once in the Code View below private void OnSuspending(object sender, SuspendingEventArgs e) { … } the following should be entered:
protected override void OnActivated(IActivatedEventArgs e) { base.OnActivated(e); try { if (e.Kind == ActivationKind.VoiceCommand) { VoiceCommandActivatedEventArgs args = (VoiceCommandActivatedEventArgs)e; Library.Command = args.Result.SemanticInterpretation.Properties["colour"].FirstOrDefault(); } } catch { } Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e); } Window.Current.Activate(); }
It should then appear as such:
Step 10
From the Solution Explorer select MainPage.xaml
Step 11
Select from the Menu, View then Designer
Step 12
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <TextBlock Grid.Row="0" x:Name="Title"/> <Rectangle Grid.Row="1" Name="Display"/> </Grid>
It should appear as such:
Step 13
Select from the Menu, View then Code
Step 14
Once in the Code View below the public MainPage() { … } the following should be entered:
protected override void OnNavigatedTo(NavigationEventArgs e) { Library.Parse(Title, Display); }
It should then appear as such:
Step 15
Once done select from the Menu, Project, then Add New Item…
Step 16
From the Add New Item window select Visual C# from Installed and select Data then select XML File from the list, then type in the Name as VCD.xml before selecting Add to add the file to the Project
Step 17
Once in the View for VCD.xml below <?xml version=”1.0″ encoding=”utf-8″ ?> the following should be entered:
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2"> <CommandSet xml:lang="en-us" Name="ColourCommandSet_en-us"> <AppName> Colour </AppName> <Example> Show Red </Example> <Command Name="showColour"> <Example> Show Corn Flower Blue </Example> <ListenFor RequireAppName="BeforeOrAfterPhrase">Show {colour}</ListenFor> <Feedback> Showing {colour} </Feedback> <Navigate Target="foo"/> </Command> <PhraseTopic Label="colour"/> </CommandSet> <CommandSet xml:lang="en-gb" Name="ColourCommandSet_en-gb"> <AppName> Colour </AppName> <Example> Show Red </Example> <Command Name="showColour"> <Example> Show Corn Flower Blue </Example> <ListenFor RequireAppName="BeforeOrAfterPhrase">Show {colour}</ListenFor> <Feedback> Showing {colour} </Feedback> <Navigate Target="foo"/> </Command> <PhraseTopic Label="colour"/> </CommandSet> </VoiceCommands>
It should then appear as such:
Step 18
That completes the Universal Windows Application so Save the Project then select the Debug and Local Machine option to run the Application
Step 19
Once the Local Machine has started the Application should then appear
Step 20
Then Exit the application by selecting Stop Debugging in Visual Studio Community 2015
Step 21
After the Application has stopped running you can then tap the Microphone button from Cortana on the Windows 10 Taskbar or if enabled say Hey, Cortana then say “Colour Show Cornflower Blue” to show the spoken Colour in the Application
Step 22
To Exit the application select the Close button on the top right of the Application
Step 23
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 24
Once the Emulator has started the Application should then appear
Step 25
Then Exit the application by selecting Stop Debugging in Visual Studio Community 2015
Step 26
After the Application has stopped running you can then tap the Search button on the bottom of the Emulator to launch Cortana you may need to set it up, so follow any steps to Use Cortana with a Microsoft Account but can choose to Sign in to just this app instead option when reached, once done can tap the Microphone button and then say “Colour Show Cornflower Blue” to launch the Application and show the spoken Colour
Step 27
To Exit the application select the Close button on the top right of the Application

Windows 10 – Universal Windows Platform – Colour Control
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in the Name as ColourControl and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as ColourPicker.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for ColourPicker.cs the following should be entered:
using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Markup; namespace ColourControl { public class ColourPicker : ComboBox { private static IEnumerable<string> splitCapital(string text) { Regex regex = new Regex(@"\p{Lu}\p{Ll}*"); foreach (Match match in regex.Matches(text)) { yield return match.Value; } } private Dictionary<string, Color> colours = typeof(Colors) .GetRuntimeProperties() .Select(c => new { Color = (Color)c.GetValue(null), Name = string.Join(" ", splitCapital(c.Name)) }).ToDictionary(x => x.Name, x => x.Color); public ColourPicker() { this.ItemTemplate = (DataTemplate)XamlReader.Load( "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" + "<StackPanel Orientation=\"Horizontal\">" + "<Rectangle Width=\"20\" Height=\"15\" Margin=\"5,0\"><Rectangle.Fill>" + "<SolidColorBrush Color=\"{Binding Value}\"/></Rectangle.Fill></Rectangle>" + "<TextBlock VerticalAlignment=\"Center\" Text=\"{Binding Key}\"/>" + "</StackPanel></DataTemplate>"); this.SelectedValuePath = "Value"; this.ItemsSource = colours; } public Color Selected { get { return ((KeyValuePair<string, Color>)SelectedItem).Value; } } } }
It should then appear as such:
Step 7
Then select from the Menu, Build, then Build Solution
Step 8
From the Solution Explorer select MainPage.xaml
Step 9
Select from the Menu, View then Designer
Step 10
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <local:ColourPicker Grid.Row="0" x:Name="Picker" SelectionChanged="Picker_SelectionChanged" HorizontalAlignment="Stretch"/> <Rectangle Grid.Row="1" Name="Display"/> </Grid>
It should appear as such:
Step 11
Select from the Menu, View then Code
Step 12
Once in the Code View below the public MainPage() { … } the following should be entered:
private void Picker_SelectionChanged(object sender, SelectionChangedEventArgs e) { Display.Fill = new SolidColorBrush(Picker.Selected); }
It should then appear as such:
Step 13
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 14
Once the Simulator has started the Application should then appear
Step 15
After the Application has started running you can select a Colour from the list to see a preview of it in the Application
Step 16
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 17
Once the Emulator has started the Application should then appear
Step 18
After the Application has started running you can select a Colour from the list to see a preview of it in the Application
Step 19
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Font Control
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in the Name as FontControl and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as FontPicker.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for FontPicker.cs the following should be entered:
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Markup; using Windows.UI.Xaml.Media; namespace FontControl { public class FontPicker : ComboBox { private string[] fonts = { "Arial", "Calibri", "Cambria", "Cambria Math", "Comic Sans MS", "Courier New", "Ebrima", "Gadugi", "Georgia", "Javanese Text", "Leelawadee UI", "Lucida Console", "Malgun Gothic", "Microsoft Himalaya", "Microsoft JhengHei", "Microsoft JhengHei UI", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Tai Le", "Microsoft YaHei", "Microsoft YaHei UI", "Microsoft Yi Baiti", "Mongolian Baiti", "MV Boli", "Myanmar Text", "Nirmala UI", "Segoe Print", "Segoe UI", "Segoe UI Emoji", "Segoe UI Historic", "Segoe UI Symbol", "SimSun", "NSimSun", "Times New Roman", "Trebuchet MS", "Verdana", "Webdings", "Wingdings", "Yu Gothic", "Yu Gothic UI" }; public FontPicker() { this.ItemTemplate = (DataTemplate)XamlReader.Load( "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" + "<TextBlock Text=\"{Binding}\" FontFamily=\"{Binding}\"/>" + "</DataTemplate>"); this.ItemsSource = fonts; } public FontFamily Selected { get { return new FontFamily((string)SelectedItem); } } } }
It should then appear as such:
Step 7
Then select from the Menu, Build, then Build Solution
Step 8
From the Solution Explorer select MainPage.xaml
Step 9
Select from the Menu, View then Designer
Step 10
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <local:FontPicker Grid.Row="0" x:Name="Picker" SelectionChanged="Picker_SelectionChanged" HorizontalAlignment="Stretch"/> <TextBlock Grid.Row="1" Name="Display" TextWrapping="Wrap" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid>
It should appear as such:
Step 11
Select from the Menu, View then Code
Step 12
Once in the Code View below the public MainPage() { … } the following should be entered:
private void Picker_SelectionChanged(object sender, SelectionChangedEventArgs e) { Display.Text = "abcdefghijklmnopqrstuvwxyz " + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" + "1234567890.:,; '\"(!?) +-*/=\n\n" + "The quick brown fox jumps over the lazy dog"; Display.FontFamily = Picker.Selected; }
It should then appear as such:
Step 13
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 14
Once the Simulator has started the Application should then appear
Step 15
After the Application has started running you can select a Font from the list to see a preview of it in the Application
Step 16
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 17
Once the Emulator has started the Application should then appear
Step 18
After the Application has started running you can select a Font from the list to see a preview of it in the Application
Step 19
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Gauge Control
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in the Name as GaugeControl and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select XAML then select User Control from the list, then type in the Name as Gauge.xaml before selecting Add to add the file to the Project
Step 6
The Design View will be displayed along with the XAML View and in this below <Grid> enter the following XAML:
<Viewbox> <Canvas Height="300" Width="300" Name="Display"/> </Viewbox>
It should appear as such:
Step 7
Select from the Menu, View then Code
Step 8
Once in the Code View below the public Gauge() { … } the following should be entered:
private Brush foreground = new SolidColorBrush(Windows.UI.Colors.White); private Brush background = ((Brush)App.Current.Resources["SystemControlBackgroundAccentBrush"]); private Windows.UI.Xaml.Shapes.Rectangle needle; private int needleWidth = 2; private int needleLength = 0; private double diameter = 0; private int value = 0; private int minimum = 0; private int maximum = 100; private TransformGroup transformGroup(double angle, double x, double y) { TransformGroup transformGroup = new TransformGroup(); TranslateTransform firstTranslate = new TranslateTransform() { X = x, Y = y }; transformGroup.Children.Add(firstTranslate); RotateTransform rotateTransform = new RotateTransform() { Angle = angle }; transformGroup.Children.Add(rotateTransform); TranslateTransform secondTranslate = new TranslateTransform() { X = diameter / 2, Y = diameter / 2 }; transformGroup.Children.Add(secondTranslate); return transformGroup; } private void indicator(int value) { double percentage = (((double)value / (double)maximum) * 100); double position = (percentage / 2) + 5; needle.RenderTransform = transformGroup(position * 6, -needleWidth / 2, -needleLength + 4.25); } private void init(Canvas canvas) { canvas.Children.Clear(); diameter = canvas.Width; double inner = diameter; Windows.UI.Xaml.Shapes.Ellipse face = new Windows.UI.Xaml.Shapes.Ellipse() { Height = diameter, Width = diameter, Fill = background }; canvas.Children.Add(face); Canvas markers = new Canvas() { Width = inner, Height = inner }; for (int i = 0; i < 51; i++) { Windows.UI.Xaml.Shapes.Rectangle marker = new Windows.UI.Xaml.Shapes.Rectangle() { Fill = foreground }; if ((i % 5) == 0) { marker.Width = 4; marker.Height = 16; marker.RenderTransform = transformGroup(i * 6, -(marker.Width / 2), -(marker.Height * 2 + 4.5 - face.StrokeThickness / 2 - inner / 2 - 16)); } else { marker.Width = 2; marker.Height = 8; marker.RenderTransform = transformGroup(i * 6, -(marker.Width / 2), -(marker.Height * 2 + 12.75 - face.StrokeThickness / 2 - inner / 2 - 16)); } markers.Children.Add(marker); } markers.RenderTransform = new RotateTransform() { Angle = 30, CenterX = diameter / 2, CenterY = diameter / 2 }; canvas.Children.Add(markers); needle = new Windows.UI.Xaml.Shapes.Rectangle() { Width = needleWidth, Height = (int)diameter / 2 - 30, Fill = foreground }; canvas.Children.Add(needle); Windows.UI.Xaml.Shapes.Ellipse middle = new Windows.UI.Xaml.Shapes.Ellipse() { Height = diameter / 10, Width = diameter / 10, Fill = foreground }; Canvas.SetLeft(middle, (diameter - middle.ActualWidth) / 2); Canvas.SetTop(middle, (diameter - middle.ActualHeight) / 2); canvas.Children.Add(middle); } public int Minimum { get { return minimum; } set { minimum = value; } } public int Maximum { get { return maximum; } set { maximum = value; } } public int Value { get { return value; } set { if (value >= Minimum && value <= Maximum) { this.value = value; indicator(value); } } }
While still in the Code View in the public Gauge() { … } below this.InitializeComponent(); the following should be entered:
init(Display);
It should then appear as such:
Step 9
Then select from the Menu, Build, then Build Solution
Step 10
From the Solution Explorer select MainPage.xaml
Step 11
Select from the Menu, View then Designer
Step 12
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<local:Gauge Width="300" Value="25"/>
It should appear as such:
Step 13
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 14
Once the Simulator has started the Application should then appear displaying the Gauge Control with the set Value in the Application
Step 15
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 16
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 17
Once the Emulator has started the Application should then appear displaying the Gauge Control with the set Value in the Application
Step 18
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Offset Control
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in the Name as OffsetControl and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as OffsetPanel.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for RadialPanel.cs the following should be entered:
using System; using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; namespace OffsetControl { public class OffsetPanel : Panel { private bool ignorePropertyChange; private static void OnMaximumColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OffsetPanel source = (OffsetPanel)d; int value = (int)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } if (value < int.MinValue || value > int.MaxValue) { source.ignorePropertyChange = true; source.SetValue(e.Property, (int)e.OldValue); throw new ArgumentException("OnMaximumColumnsPropertyChanged InvalidValue", "value"); } source.InvalidateMeasure(); } private static void OnItemHeightOrWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OffsetPanel source = (OffsetPanel)d; double value = (double)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } if (!double.IsNaN(value) && ((value <= 0.0) || double.IsPositiveInfinity(value))) { source.ignorePropertyChange = true; source.SetValue(e.Property, (double)e.OldValue); throw new ArgumentException("OnItemHeightOrWidthPropertyChanged InvalidValue", "value"); } source.InvalidateMeasure(); } public int MaximumColumns { get { return (int)GetValue(MaximumColumnsProperty); } set { SetValue(MaximumColumnsProperty, value); } } public static readonly DependencyProperty MaximumColumnsProperty = DependencyProperty.Register("MaximumColumns", typeof(int), typeof(OffsetPanel), new PropertyMetadata(2, OnMaximumColumnsPropertyChanged)); public double ColumnOffset { get { return (double)GetValue(ColumnOffsetProperty); } set { SetValue(ColumnOffsetProperty, value); } } public static readonly DependencyProperty ColumnOffsetProperty = DependencyProperty.Register("ColumnOffset", typeof(double), typeof(OffsetPanel), new PropertyMetadata(10.0, OnItemHeightOrWidthPropertyChanged)); public double RowOffset { get { return (double)GetValue(RowOffsetProperty); } set { SetValue(RowOffsetProperty, value); } } public static readonly DependencyProperty RowOffsetProperty = DependencyProperty.Register("RowOffset", typeof(double), typeof(OffsetPanel), new PropertyMetadata(5.0, OnItemHeightOrWidthPropertyChanged)); public double SpacingY { get { return (double)GetValue(SpacingYProperty); } set { SetValue(SpacingYProperty, value); } } public static readonly DependencyProperty SpacingYProperty = DependencyProperty.Register("SpacingY", typeof(double), typeof(OffsetPanel), new PropertyMetadata(10.0, OnItemHeightOrWidthPropertyChanged)); public double SpacingX { get { return (double)GetValue(SpacingXProperty); } set { SetValue(SpacingXProperty, value); } } public static readonly DependencyProperty SpacingXProperty = DependencyProperty.Register("SpacingX", typeof(double), typeof(OffsetPanel), new PropertyMetadata(10.0, OnItemHeightOrWidthPropertyChanged)); protected override Size MeasureOverride(Size availableSize) { double itemWidth = 0.0; double itemHeight = 0.0; double x = 0; double y = 0; for (int i = 0; i < Children.Count; i++) { UIElement element = Children[i]; element.Measure(availableSize); double width = element.DesiredSize.Width + x; double height = element.DesiredSize.Height + y; if (width > itemWidth) itemWidth = width; if (height > itemHeight) itemHeight = height; y += SpacingY; if ((i + 1) % MaximumColumns == 0) { x -= SpacingX * (MaximumColumns - 1); x += RowOffset; y += ColumnOffset; } else { x += SpacingX; } } return new Size(itemWidth, itemHeight); } protected override Size ArrangeOverride(Size finalSize) { double x = 0; double y = 0; for (int i = 0; i < Children.Count; i++) { UIElement element = Children[i]; element.Arrange(new Rect(new Point(x, y), element.DesiredSize)); y += SpacingY; if ((i + 1) % MaximumColumns == 0) { x -= SpacingX * (MaximumColumns - 1); x += RowOffset; y += ColumnOffset; } else { x += SpacingX; } } return finalSize; } } }
It should then appear as such:
Step 7
Then select from the Menu, Build, then Build Solution
Step 8
From the Solution Explorer select MainPage.xaml
Step 9
Select from the Menu, View then Designer
Step 10
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<local:OffsetPanel SpacingX="50" SpacingY="20" MaximumColumns="5" Height="300" Width="300"> <Rectangle Width="75" Height="75" Fill="Black"/> <Rectangle Width="75" Height="75" Fill="Gray"/> <Rectangle Width="75" Height="75" Fill="Red"/> <Rectangle Width="75" Height="75" Fill="Orange"/> <Rectangle Width="75" Height="75" Fill="Yellow"/> <Rectangle Width="75" Height="75" Fill="Green"/> <Rectangle Width="75" Height="75" Fill="Cyan"/> <Rectangle Width="75" Height="75" Fill="Blue"/> <Rectangle Width="75" Height="75" Fill="Magenta"/> <Rectangle Width="75" Height="75" Fill="Purple"/> </local:OffsetPanel>
It should appear as such:
Step 11
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 12
Once the Simulator has started the Application should then appear displaying the Offset Control in the Application
Step 13
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 14
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 15
Once the Emulator has started the Application should then appear displaying the Offset Control in the Application
Step 16
To Exit the application select Stop Debugging in Visual Studio Community 2015

Windows 10 – Universal Windows Platform – Radial Control
Step 1
Download Visual Studio Community 2015 and install it onto your computer, if it’s already downloaded and installed select Launch to start Visual Studio Community 2015 or if it has already been downloaded and installed then start the application you may also need to Enable your device for development.
Step 2
Once Visual Studio Community 2015 has started select File, then New, then Project… from the Menu.
Step 3
From the New Project window select Visual C# from Installed, Templates then select Blank App (Windows Universal) from the list, then type in the Name as RadialControl and select a Location to save to before selecting Ok to create the Project.
Step 4
Once done select from the Menu, Project, then Add New Item…
Step 5
From the Add New Item window select Visual C# from Installed and select Code then select Code File from the list, then type in the Name as RadialPanel.cs before selecting Add to add the file to the Project
Step 6
Once in the Code View for RadialPanel.cs the following should be entered:
using System; using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; namespace RadialControl { public partial class RadialPanel : Panel { private bool ignorePropertyChange; private static void OnIsOrientedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RadialPanel source = (RadialPanel)d; bool value = (bool)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } source.InvalidateMeasure(); } private static void OnItemHeightOrWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RadialPanel source = (RadialPanel)d; double value = (double)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } if (!double.IsNaN(value) && ((value <= 0.0) || double.IsPositiveInfinity(value))) { source.ignorePropertyChange = true; source.SetValue(e.Property, (double)e.OldValue); throw new ArgumentException("OnItemHeightOrWidthPropertyChanged InvalidValue", "value"); } source.InvalidateMeasure(); } public double ItemHeight { get { return (double)GetValue(ItemHeightProperty); } set { SetValue(ItemHeightProperty, value); } } public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register("ItemHeight", typeof(double), typeof(RadialPanel), new PropertyMetadata(double.NaN, OnItemHeightOrWidthPropertyChanged)); public double ItemWidth { get { return (double)GetValue(ItemWidthProperty); } set { SetValue(ItemWidthProperty, value); } } public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register("ItemWidth", typeof(double), typeof(RadialPanel), new PropertyMetadata(double.NaN, OnItemHeightOrWidthPropertyChanged)); public bool IsOriented { get { return (bool)GetValue(IsOrientedProperty); } set { SetValue(IsOrientedProperty, value); } } public static readonly DependencyProperty IsOrientedProperty = DependencyProperty.Register("IsOriented", typeof(bool), typeof(RadialPanel), new PropertyMetadata(false, OnIsOrientedPropertyChanged)); protected override Size MeasureOverride(Size constraint) { double itemWidth = ItemWidth; double itemHeight = ItemHeight; bool hasFixedWidth = !double.IsNaN(itemWidth); bool hasFixedHeight = !double.IsNaN(itemHeight); Size itemSize = new Size( hasFixedWidth ? itemWidth : constraint.Width, hasFixedHeight ? itemHeight : constraint.Height); foreach (UIElement element in Children) { element.Measure(itemSize); } return itemSize; } protected override Size ArrangeOverride(Size finalSize) { double itemWidth = ItemWidth; double itemHeight = ItemHeight; bool hasFixedWidth = !double.IsNaN(itemWidth); bool hasFixedHeight = !double.IsNaN(itemHeight); double radiusX = finalSize.Width * 0.5; double radiusY = finalSize.Height * 0.5; double count = Children.Count; double deltaAngle = 2 * Math.PI / count; Point centre = new Point(finalSize.Width / 2, finalSize.Height / 2); for (int i = 0; i < count; i++) { UIElement element = Children[i]; Size elementSize = new Size( hasFixedWidth ? itemWidth : element.DesiredSize.Width, hasFixedHeight ? itemHeight : element.DesiredSize.Height); double angle = i * deltaAngle; double x = centre.X + radiusX * Math.Cos(angle) - elementSize.Width / 2; double y = centre.Y + radiusY * Math.Sin(angle) - elementSize.Height / 2; if (IsOriented) { element.RenderTransform = null; } else { element.RenderTransformOrigin = new Point(0.5, 0.5); element.RenderTransform = new RotateTransform() { Angle = angle * 180 / Math.PI }; } element.Arrange(new Rect(x, y, elementSize.Width, elementSize.Height)); } return finalSize; } } }
It should then appear as such:
Step 7
Then select from the Menu, Build, then Build Solution
Step 8
From the Solution Explorer select MainPage.xaml
Step 9
Select from the Menu, View then Designer
Step 10
The Design View will be displayed along with the XAML View and in this below <Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”> enter the following XAML:
<local:RadialPanel Height="300" Width="300"> <Rectangle Width="50" Height="50" Fill="Black"/> <Rectangle Width="50" Height="50" Fill="Gray"/> <Rectangle Width="50" Height="50" Fill="Red"/> <Rectangle Width="50" Height="50" Fill="Orange"/> <Rectangle Width="50" Height="50" Fill="Yellow"/> <Rectangle Width="50" Height="50" Fill="Green"/> <Rectangle Width="50" Height="50" Fill="Cyan"/> <Rectangle Width="50" Height="50" Fill="Blue"/> <Rectangle Width="50" Height="50" Fill="Magenta"/> <Rectangle Width="50" Height="50" Fill="Purple"/> </local:RadialPanel>
It should appear as such:
Step 11
That completes the Universal Windows Application so Save the Project then select the Debug and Simulator option to run the Application
Step 12
Once the Simulator has started the Application should then appear displaying the Radial Control in the Application
Step 13
To Exit the application select Stop Debugging in Visual Studio Community 2015
Step 14
Another option is to run as a Windows 10 Mobile application, select Debug and select Emulator 10.0.10586.0 WVGA 4 inch 512MB option to run the Application
Step 15
Once the Emulator has started the Application should then appear displaying the Radial Control in the Application
Step 16
To Exit the application select Stop Debugging in Visual Studio Community 2015