Thursday, September 16, 2010

Login and registration process in WPF application

Introduction:
In this article I am creating a simple application for login and registration using WPF in visual studio 2010. In this application I am creating two window forms one is for Registration and another is for login. First of all user will register after then he/she can login.
Now I am going to discuss in brief about this application.
Step1: Open Visual Studio 2010 -> File -> New -> Project.
New project template will display and select WPF Application like as follows
Step 2: Enter your project name and click on OK button.
Step 3: You will get the MainWindow.xaml window form, if you want to change then rename it and also change the StartupUri property of application into App.xaml like as follows:
App.xaml:
<Application x:Class="Login_WPF.App"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            StartupUri="Registration.xaml">
   <Application.Resources></Application.Resources>
</Application>
Step 4: Now design your Registration page as figure 2 or copy and page following inline code.
Registration.xaml:
<Window x:Class="Login_WPF.Registration"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       Title="Registration" Height="387" Width="528" Background="Black">
   <Grid  Height="350" Width="525" Background="Bisque">
       <TextBlock Height="23" HorizontalAlignment="Left" Margin="10,5,0,0" Name="textBlockHeading" Text="Registration:" VerticalAlignment="Top" Width="110"  FontSize="17" FontStretch="ExtraCondensed"/>
       <!--Button as a Link button using style-->
Read more: C# Corner