Introduction
Today we will learn about a very interesting class GUID (Globally Unique Identifier) in Metro Style applications. It is a predefined utility that we can use to randomly generate an identifier number. GUIDs are used for many purposes, including the purpose of generating automatic words since a GUID is highly unlikely to be duplicated each time one is generated. Here we will take a simple example to generate a unique 10-digit word. GUIDs have many other purposes, including identification of interfaces for COM.
In the following we are including the entire code of XAML file and code behind file to create this mini application.
Step 1 : First, you will create a new Metro Style Application. Let us see the description with images of how to create it.
- Open Visual Studio 2012
- File -> New -> Project
- Choose Template -> Visual C# -> Metro Style Application
- Rename the application

Step 2 : In the Solution Explorer there are two files that we will primarily work with; the MainPage.xaml and MainPage.xaml.cs files.

Step 3 : The MainPage.xaml file is as in the following code:
Code :
<Page
x:Class="App1.MainPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App7"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="76*"/>
<RowDefinition Height="55*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="37*"/>
<RowDefinition Height="70*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="119*"/>
<RowDefinition Height="9*"/>
<RowDefinition Height="359*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.333*"/>
<ColumnDefinition Width="0.022*"/>
<ColumnDefinition Width="0.312*"/>
<ColumnDefinition Width="0.333*"/>
</Grid.ColumnDefinitions>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Blue" Offset="1"/>
<GradientStop Color="Green"/>
</LinearGradientBrush>
</Grid.Background>
<TextBlock Text="User Name" FontSize="20" TextWrapping="Wrap"
Margin="0,8" Grid.Row="2" HorizontalAlignment="Right"
VerticalAlignment="Center" Height="24" Width="98"/>
<TextBlock x:Name="namvalidate" FontSize="20" Foreground="Red"
TextWrapping="Wrap" Margin="0,20" Grid.Column="3"
Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center"
Visibility="Collapsed" Height="0" Width="0"/>
<TextBlock HorizontalAlignment="Right" FontSize="20" Margin="0,7,0,6"
VerticalAlignment="Center" Grid.Row="3" Text="Email ID"
TextWrapping="Wrap" Height="24" Width="72"/>
<TextBlock x:Name="emailvalidate" FontSize="20" Foreground="Red"
TextWrapping="Wrap" Margin="0,19,0,18" Grid.Column="3"
Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Center"
Visibility="Collapsed" Height="0" Width="0"/>
<TextBlock x:Name="agevalidate" FontSize="20" Foreground="Red"
TextWrapping="Wrap" Margin="0,60,0,59" Grid.Column="3"
Grid.Row="6" HorizontalAlignment="Left" VerticalAlignment="Center"



Abhishek DubeyPosted Jul 8, 2012, 4:38 AM
great effort subham keep it up