Jul 13, 2015

simple WPF application

Open Visual Studio  and choose "File", "New", "Project..." in the main menu. Choose "WPF Application" as project type.
Choose a folder for your project and give it a name. Then press "OK"

 Visual Studio creates the project and automatically adds some files to the solution. A Window1.xaml and an App.xaml. The structure looks quite similar to WinForms, except that the Window1.designer.cs file is no longer code but it's now declared in XAML as Window1.xaml


Open the Window1.xaml file in the WPF designer and drag a Button and a TextBox from the toolbox to the Window




this is the UI of the WPF contains both xmal and visuval also.

Select the Button
 Doubleclick on the "Click" event to create a method in the codebehind that is called, when the user clicks on the button. 

private void Button_Click(object sender, RoutedEventArgs e)
        {
            Textbox1.Text = "Heloo Vamsi This is First WPF";
        }

when the button gets clicked and we are done! Start the application by hit [F5] on your keyboard.




No comments:

Post a Comment