Create the first WPF Application

Source: Internet
Author: User
In Visual Studio 2008

Open vs2008 and select "file", "new", and "project" in the main menu )...". Select "WPF Application (WPF Application)" as the project type )".

Name the project and select a folder path to store the project. Click "OK )".

Vs automatically adds some files to the project when creating the project. A window1.xaml file and an app. XAML file. Its structure is very similar to that of winform,The window1.designer. CS file is a code file and replacedThe XAML file of window1.xaml, such:

Open in the WPF DesignerWindow1.xamlFile, drag a button and text box in the toolbox.

Select the button to switch the attribute window to the event view (click a small yellow tab ). Double-click the "click" event and create a method called when the user clicks the button in the post code.

Note: If you cannot find the yellow button, it may be that Service Pack 1 for visualstudio is not installed on your computer. alternatively, you can double-click the button in the designer to achieve the same effect.

Vs automatically creates a method called when the user clicks the button in the post code:

Private void button#click (Object sender, routedeventargs e) {textbox1.text = "Hello WPF! ";}

The WPF Designer will also automatically specify a name for this text box"Textbox1". Set the text box to "Hello WPF!" When the button is clicked! ", Press F5 on the keyboard to run the program:

Cool.

(Original)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.