Skip to main content

How to create Login Screen for Windows 8

Whatz up guys..
Today i am going create a Log in screen for Windows 8.I think it will help you guys ;)
best of luck !


Step 1: Select Blank application .

Step 2: In the MainPage.XAML file we write the following code:
  • This is the coding for Login popup
 <ContentControl x:Name="Logincontainer" Height="450" Margin="0,194,0,124">  
       <Popup x:Name="logincontroler" IsOpen="False" >  
         <StackPanel Orientation="Vertical" Background="Purple" Height="400" x:Name="popup" >  
           <StackPanel>  
             <TextBlock Text="Sign In" HorizontalAlignment="Center" Foreground="White" FontSize="25" />  
           </StackPanel>  
           <StackPanel Orientation="Horizontal" Margin="0,50" HorizontalAlignment="Center">  
             <TextBlock Text="User Id" Margin="10" Foreground="White" FontSize="25" />  
             <TextBox x:Name="id" Height="40" Margin="13,1" Width="408"/>  
           </StackPanel>  
           <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">  
             <TextBlock Text="Password" Foreground="White" FontSize="25" />  
             <PasswordBox x:Name="pwd" Height="40" Margin="5,1" Width="408"/>  
           </StackPanel>  
           <StackPanel Orientation="Horizontal" Margin="0,50" HorizontalAlignment="Center">  
             <Button x:Name="loginclick" Click="loginclick_Click_1" Foreground="Wheat"  Width="100" Content="Login" ></Button>  
             <Button x:Name="cancel" Click="cancel_Click_1"  Foreground="Wheat" Width="100" Content="Cancel" ></Button>  
           </StackPanel>  
         </StackPanel>  
       </Popup>  
     </ContentControl>  




  • Coding for side bar.
    Add these coding under the above code in   MainPage.XAML

     <ContentControl Grid.Column="1" HorizontalAlignment="Right" x:Name="parentcontroler">  
       <Grid Background="DarkBlue" >  
         <Grid.RowDefinitions>  
           <RowDefinition Height="auto"></RowDefinition>  
           <RowDefinition Height="100"></RowDefinition>  
           <RowDefinition Height="*"></RowDefinition>  
           <RowDefinition Height="150"></RowDefinition>  
           <RowDefinition Height="*" ></RowDefinition>  
           <RowDefinition Height="100"></RowDefinition>  
           <RowDefinition Height="auto"></RowDefinition>  
           <RowDefinition Height="200"></RowDefinition>  
           <RowDefinition Height="auto"></RowDefinition>  
           <RowDefinition Height="200"></RowDefinition>  
         </Grid.RowDefinitions>  
         <TextBlock Grid.Row="3"  FontFamily="Segoe UI Light" FontSize="26.667" TextAlignment="Center"><Run Text="Welcome to"/><LineBreak/><Run FontSize="32" Text="Application Name"/></TextBlock>  
         <Button x:Name="signinBtn" VerticalAlignment="Top" Content="Sign in" Grid.Row="7" Height="50"  Width="313" Background="DarkBlue" Foreground="#FFF9F7F7" BorderBrush="#FF898989" HorizontalAlignment="Center"  FontSize="18.667" FontFamily="Segoe UI Light" Click="signinBtn_Click_1"/>  
       </Grid>  
     </ContentControl>  


  • Add following code in MainPage.cs page under the signin button click event

  private void signinBtn_Click_1(object sender, RoutedEventArgs e)  
     {  
       if (!logincontroler.IsOpen)  
       {  
         parentcontroler.IsEnabled = false;  
         this.Opacity = .4;  
         Logincontainer.IsEnabled = true;  
         logincontroler.IsOpen = true;  
         popup.Width = Window.Current.Bounds.Width;  
       }  
       else  
       {  
         logincontroler.IsOpen = false;  
         this.Opacity = 1.0;  
         parentcontroler.IsEnabled = true;  
       }  
     }  

Thats all guys :)...

.............................................................................................................................................................
Final  MainPage.xaml should like this 


Final MainPage.cs should like this...

Thank You Guyz :) :) ....

Comments

Popular posts from this blog

Imagine Cup 2014

Hi guys .. Get ready for imagine cup 2014 In NewZealand .In the next few days imagine cup 2013 finals will happen in Russia. So It is time to wear your thinking hat.You have one year to develop your marvelous ideas.  The Microsoft Imagine Cup is the world’s most prestigious student technology competition, bringing together student innovators from all over the world. If you have a great idea for a new app, bring it to life through Imagine Cup. Over the past 10 years, more than 1.65 million students from 190 countries have participated in the Imagine Cup. 

Visual Studio 2013 New Editor Features

In Visual Studio 2013, we have introduced new features that boost productivity and save time when working inside the Editor. Some of these are new features and some are the most popular extensions from  Productivity Power Tools . These features are a result of the feedback you gave us through  User Voice  requests, forum posts and Connect bugs. The MVP community also helped us pick some of these experiences. Our primary focus for the Editor in this version is to keep the developer in context as much as possible. This blog post describes capabilities that bring information to your fingertips and allow you to do as much as possible without leaving your place in code.

C# Character Escape Sequences

Character combinations consisting of a backslash ( \ ) followed by a letter or by a combination of digits are called "escape sequences." To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences. An escape sequence is regarded as a single character and is therefore valid as a character constant.