XBOX ONE App Using UWP

Introduction

The Xbox One is a home video game console developed by Microsoft. We can develop UWP Applications and XBOX One consoles also.

Before reading this article, please go through the following articles and resources.

  1. Introduction to Universal Windows Platform (UWP) App Development Using Windows 10 And Visual Studio 2015
  2. UWP on Xbox One
  3. Xbox One Developer Mode Activation

Reading this article, you can learn how to develop XBOX ONE Application using Universal Windows Apps development with XAML, Visual C# and XBOX ONE. This application changes the stackpanel background at runtime.

The following important tools are required for developing UWP,

  1. Windows 10 (Recommended)
  2. Visual Studio 2015 Community Edition (It is a free software available online)
  3. XBOX ONE Console

Now, let's discuss step by step app development.

Step 1 - Open Visual Studio 2015 -> Start -> New Project-> Select Universal (under Visual C#->Windows)-> Blank App -> Give suitable name for your App (UWPXBOXONE) ->OK.

development

Step 2 - Choose the Target and Minimum platform version that your Windows Universal Application will support. After the Project create App.xaml and MainPage.xaml.

development

Step 3 - Open (double Click) the file MainPage.xaml in the Solution Explorer.

Set the Xbox scale

development

Step 4 - Click on the Toolbox tab on the left to open the list of Common XAML controls. Expand Common XAML Controls, and drag the required control to the middle of the design canvas

Add a stackpanel for displaying images

Set the Xbox scale

Add an image to Asset Folder and set the image as stackpanel Background,

  1. <StackPanel.Background>  
  2.     <ImageBrush ImageSource="Assets/01.jpg"></ImageBrush>  
  3. </StackPanel.Background>  
<StackPanel.Background /> <imagebrush imagesource= ">

Add a Text Block for Title,

Add a Text Block for Title

Add a Button for Changing the images at Runtime.

Add a Text Block for Title

Step 5 - Create a button click event method,

Add a Text Block for Title

Add the following Namespace and Code in click Event Method

  1. using Windows.UI.Xaml.Media;  
  2. using Windows.UI.Xaml.Media.Imaging;  
  3. private void btnImagechange_Click(object sender, RoutedEventArgs e) {  
  4.     ImageBrush myBrush = new ImageBrush();  
  5.     Image image = new Image();  
  6.     image.Source = new BitmapImage(new Uri("ms-appx:///Assets//02.jpg"));  
  7.     myBrush.ImageSource = image.Source;  
  8.     SPXBOX.Background = myBrush;  


Note- Automatically the following code will be generated in XAML code view, while we are done in the design view.
  1. <Page  
  2. x: Class = "UWPXBOXONE.MainPage"  
  3. xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  4. xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"  
  5. xmlns: local = "using:UWPXBOXONE"  
  6. xmlns: d = "http://schemas.microsoft.com/expression/blend/2008"  
  7. xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"  
  8. mc: Ignorable = "d" >  
  9.     <  
  10.     Grid Background = "{ThemeResource ApplicationPageBackgroundThemeBrush}" >  
  11.     <  
  12.     StackPanel x: Name = "SPXBOX"  
  13. HorizontalAlignment = "Left"  
  14. Height = "343"  
  15. Margin = "139,142,0,0"  
  16. VerticalAlignment = "Top"  
  17. Width = "681" >  
  18.     <  
  19.     StackPanel.Background >  
  20.     <  
  21.     ImageBrush ImageSource = "Assets/01.jpg" > < /ImageBrush> <  
  22.     /StackPanel.Background> <  
  23.     /StackPanel> <  
  24.     TextBox x: Name = "tblTitle"  
  25. HorizontalAlignment = "Left"  
  26. Margin = "361,34,0,0"  
  27. TextWrapping = "Wrap"  
  28. Text = "UWP XBOX ONE App Demo"  
  29. VerticalAlignment = "Top" / >  
  30.     <  
  31.     Button x: Name = "btnImageChange"  
  32. Content = "Change Image"  
  33. HorizontalAlignment = "Left"  
  34. Margin = "716,92,0,0"  
  35. VerticalAlignment = "Top"  
  36. ToolTipService.ToolTip = "Click to Changing the Image"  
  37. Click = "btnImagechange_Click" / >  
  38.     <  
  39.     /Grid> <  
  40.     /Page>  
Step 6 - Choose a debug option as Remote machine and set the ip address for your XBOX ONE Console.



Step 7 - XBOX ONE Console DEVHOME.

DEVHOME

DEVHOME

Step 8 - Deploy your App in XBOX ONE Console.

DEVHOME

DEVHOME

Step 9 - The output of the UWPXBOXONE App is.

Splash screen on XBOX ONE Console,

DEVHOME

Before Clicking the Change Image Button on XBOX ONE Console.

DEVHOME

DEVHOME

After Clicking the Change Image Button on XBOX ONE Console

DEVHOME

Summary - Now you have successfully created and tested UWP XBOX ONE Application using UWP, Visual C# and XBOX ONE Console.


Similar Articles