Create WPF Application in Visual Studio 2010
This wpf tutorial explains how to create wpf application step by step in Visual Studio 2010.
The goal here is to create a new Windows Presentation Foundation (WPF) application that would show a welcome message in a TextBlock. This article would help to understand WPF with C#.
Create WPF Application (Simple WPF Application)
- Start Visual Studio 2010
- Click on File -> New -> Project…
- New Project dialog will display as shown below.
- Click on Visual C# -> Select Windows
- Verify target framework version
- Select WPF Application
- Specify project Name, Location
- Click on OK
Visual Studio creates the project and automatically adds some files to the solution.
Change title of the window
Now we are going to change the title of the window.
- Change window title either from Properties window or XAML Editor. You can see a reflection in Designer view.
- There are lots of properties available to change design of the window according to our requirements.
Now we are going to create controls in WPF Application.
- Click on Toolbox
- Several controls are available in toolbox like Button, CheckBox, ComboBox, etc. You can simply design your surface by Click and drag a control from the Toolbox to the design surface.
- Click and drag TextBlock control to the design surface.
- Use different properties of the TextBlock like Text, FontSize, Margin, etc.
Run WPF Application
Run the application by clicking on Start Debugging (F5) button.
Check out the final output