Step By Step Process Of Creating StackPanel In UWP Application

Requirements

  • Visual Studio 2015 update 3

Step 1 - Open the Visual Studio 2015 Update 3. Then go to File→New→Project . Now, open a new project. 

 
Step 2 - In the New Project window, choose Visual C#  and select Universal. Then, select Blank App (Universal Windows).



Step 3 - Now, name your application and assign the location for the app.





Step 4 - Select the Target Version and Minimum Version for your Universal Windows application and after that, click ” OK”.



Step 5 - We should go to the Solution Explorer now. Choose MainPage.xaml and open XAML or Design window. Then, go to the XAML window and write some .xaml code.





Step 6 - According to your requirement of shapes, boxes, and blocks, write the code.



Step 7 - We want some option in our project, like TextBlock, button, images, and so on.
  1. <Page  
  2.     x:Class="stackpanel1.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:stackpanel1"  
  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.         <StackPanel Margin="10,10,10,10">  
  12.             <Rectangle Fill="Yellow" Height="50"/>  
  13.             <TextBlock Text="hai everybody welcome to our application" FontStyle="Italic" FontSize="26" Foreground="Purple"/>  
  14.             <Button VerticalAlignment="Center" Height="128" Width="389">click me</Button>  
  15.         </StackPanel>  
  16.     </Grid>  
  17. </Page>  




Step 8 - Write the XAML code and save all the files. After that, you can run it either on local machine or remote machine or any device. Let's choose Local Machine.



Step 9 - We can see our output below. Now, stackPanel UWP Application is created.




Similar Articles