Learn WPF from scratch (1) - Show Helloworld

tags: WPF  visual studio  ide  visualstudio  

1. Environment construction

First download VS from the VS official website. I downloaded the VS2019 community version. After the download is complete, select the installation environment: .NET desktop development, select Finish and click the modify button in the lower right corner.

 

Since it is already installed, there is no modify button.

Wait for the download to complete, and start logging in to your account.

Two, create a WPF desktop program

First choose to create a project

 

After clicking, enter WPF in the search box, and the following list appears:

 

We will find that there are 2 desktop applications with different frameworks, one is.NET Core,the other is.NET Framework, we use the.NET Core, There are differences between the two, the main application platform difference. NET Core cannot run on older systems. You can go to Baidu to search for the specific difference, so I won't go into details.

We choose .NET Core's WPF for development. After selection, you can choose the name and location of the subsequent project. My side is displayed as the default WpfApp2.

 

Click Next and select the minimum .Net Core 5.0

and click Create. Wait until the project is fully loaded.

After the loading is complete, you will see that the entire interface is roughly divided into 5 layouts:

 

1. Interface layout designer, mainly for real-time interface control layout display

2. XAML code editor, this part is the interface code of 1

3. Solution display

4. Property interface, which mainly displays the properties of the selection control.

5. Control library, including various controls, buttons, display boxes and so on.

3. Layout helloworld

Find the TextBox in the 5 control library list, hold down the mouse and drag it to the 1 interface.

We need to display Helloworld, but TextBox is now displayed by default. There are two ways to modify the display:

1. Modify the Text property of the property interface on the right and change it to HelloWorld.

 

2. Modify the Text in the red box of the XAML interface to Text="HelloWorld"

 

Both have the same effect.

Four, run

Click VS to run

 

You can get HelloWorld

Final effect:

Follow-up will explain the operation of the two interfaces MVVM and MVC. the

Intelligent Recommendation

Learn jQuery from scratch (1)

Summary This series of articles will take you into the wonderful world of jQuery, there are many authors with specific experience and solutions, even if you can use jQuery can find some cheats in read...

Learn Linux from scratch (1)

Linux basic commands: Traverse the directory: On Linux file systems, you can switch the shell session to another directory using the switch directory command cd: format: cd destination The cd command ...

Learn python from scratch (1)

First, the advantages and disadvantages Advantage 1.1 Simple, elegant, clear, (simple, easy to learn, low learning costs), and many other websites are using, for example, Douban, Google 1.2 has a very...

Learn Koa2 from scratch (1)

First, the introduction of the Koa framework Node.js is an asynchronous world. The official API supports the asynchronous programming model in the form of callback. This brings many problems, such as:...

Learn html from scratch 1

I remember learning HTML for half a year ago, but it has n’t been used very much. It should be said that it is rarely used. It does n’t do any actual combat projects on the web, so it is b...

More Recommendation

Learn java from scratch (1)

1. Intellij idea installation https://www.jetbrains.com/idea/download/#section=windowsJust download the community version (free) All the defaults can be selected during the installation process. After...

Learn MySQL from scratch (1)

Since using cloud notes, it has rarely come ·· I have been in contact with mysql before, but I still use Oracle most of the time. I have just resigned now, and I have time to learn about...

Learn g2o from scratch (1)

Learn g2o from scratch 1. g2o installation: 2. The basic frame structure of g2o: 2.1 The core of the graph 2.2 Vertices and edges 2.3 Configure the optimization algorithm and solver of SparseOptimizer...

Learn "Java" from scratch (1)

Learn "Java" from scratch (1) One, first introduce the Java development environment Two, the development tool eclipse Three, java comments (for yourself and others to read) Friends who need ...

Learn TFLearn from scratch (1)

1 Introduction Students who have used TensorFlow should know that this deep learning library is a bit difficult to use. It requires us to define all the computing nodes (ops) ourselves. For example, i...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top