Developing HoloLens Welcome App Using UWP With HoloLens Emulator

Introduction

HoloLens is the device using which we can see and hear 'holograms'. Well, that is exciting for everywhere from work environment to your home.

HoloLens Emulator -  Download it.

Before reading this article, please go through the following article.

  1. Introduction to Universal Windows Platform (UWP) App Development Using Windows 10 And Visual Studio 2015

Reading this article, you can learn how to develop Hololens application using Universal Windows Apps development with XAML, Visual C#, and Hololens Emulator.

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. HoloLens Emulator (Read this article Download HoloLens Emulator)

Now, we can 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 (UWPHoloLensWelcome) -> OK.



Step 2 - Choose the Target and Minimum platform version that your Windows Universal Application will support. After this, the project creates App.xaml and MainPage.xaml.



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

Set the HoloLens scale.



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 design canvas.

Add a stackpanel for displaying the images and add an image to Assets folder and set the image as stackpanel background.

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


Add a Text Block for Welcome message.



Note - Automatically, the following code will be generated in XAML code View, while we are done with the design View.
  1. <Page x:Class="UWPHololensWelcome.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:UWPHololensWelcome" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">  
  2.     <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  
  3.         <StackPanel x:Name="SPHolo" HorizontalAlignment="Left" Height="340" Margin="81,69,0,0" VerticalAlignment="Top" Width="696">  
  4.             <StackPanel.Background>  
  5.                 <ImageBrush ImageSource="Assets/1.jpg"></ImageBrush>  
  6.             </StackPanel.Background>  
  7.         </StackPanel>  
  8.         <TextBlock x:Name="tblTitle" HorizontalAlignment="Left" Margin="176,25,0,0" TextWrapping="Wrap" Text="Welcome to Hololens UWP App Development" VerticalAlignment="Top" Height="39" Width="549" FontSize="24" FontWeight="Bold" /> </Grid>  
  9. </Page>  
Step 5 - Choose a debug option as HoloLens Emulator.



Step 6 - Deploy your App in HoloLens Emulator.  The output of the UWPHoloLensWelcome is shown below.



Summary - Now, you have successfully created and tested HoloLens Welcome Application in Visual C# - UWP environment.