You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/get-started/csharp/tutorial-uwp.md
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
---
2
+
title: Create a Universal Windows Platform (UWP) App with Visual Studio and C#
2
3
description: Create a UWP app in Visual Studio with XAML and C#
3
4
titleSuffix: ""
4
5
ms.custom: "seodec18, get-started"
@@ -16,7 +17,7 @@ ms.workload:
16
17
---
17
18
# Tutorial: Create your first Universal Windows Platform application in Visual Studio with XAML and C#
18
19
19
-
In this 5-10 minute introduction to the Visual Studio integrated development environment (IDE), you'll create a "Hello World" app that runs on any Windows 10 device. To do so, you'll use a Universal Windows Platform (UWP) project template, Extensible Application Markup Language (XAML), and the C# programming language.
20
+
In this introduction to the Visual Studio integrated development environment (IDE), you'll create a "Hello World" app that runs on any Windows 10 device. To do so, you'll use a Universal Windows Platform (UWP) project template, Extensible Application Markup Language (XAML), and the C# programming language.
20
21
21
22
::: moniker range="vs-2017"
22
23
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link&utm_content=download+vs2017) page to install it for free.
@@ -44,23 +45,25 @@ First, create a Universal Windows Platform project. The project type comes with
44
45
45
46
4. Accept the default **Target version** and **Minimum version** settings in the **New Universal Windows Platform Project** dialog box.
46
47
47
-

48
+

48
49
::: moniker-end
49
50
50
51
::: moniker range=">=vs-2019"
51
52
52
-
2. Start Visual Studio, and on the **Start Window**, choose **Create a new project**.
53
+
2. Start Visual Studio, and on the **Start** window, choose **Create a new project**.
53
54
54
55
3. On the **Create a new project** screen, enter *Universal Windows* in the search box, choose the C# template for **Blank App (Universal Windows)**, and then choose **Next**.
55
56
56
-

57
+

58
+
59
+
> [!NOTE]
60
+
> If you don't see the **Blank App (Universal Windows)** project template, click the **Install more tools and features** link.<br><br><br><br>The Visual Studio Installer launches. Choose the **Universal Windows Platform development** workload, and then choose **Modify**.<br><br>
57
61
58
62
4. Accept the default **Target version** and **Minimum version** settings in the **New Universal Windows Platform Project** dialog box.
59
63
60
-

64
+

61
65
::: moniker-end
62
66
63
-
64
67
> [!NOTE]
65
68
> If this is the first time you have used Visual Studio to create a UWP app, a **Settings** dialog box might appear. Choose **Developer mode**, and then choose **Yes**.<br><br>
66
69
<br><br>Visual Studio installs an additional Developer Mode package for you. When the package installation is complete, close the **Settings** dialog box.
Copy file name to clipboardExpand all lines: docs/get-started/csharp/tutorial-wpf.md
+44-30Lines changed: 44 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Tutorial: Hello World app with Windows Presentation Foundation (WPF) in C#"
3
3
description: Create a simple Windows Desktop .NET app in C# with Visual Studio using the Windows Presentation Foundation (WPF) UI framework.
4
4
ms.custom: "seodec18, get-started"
5
-
ms.date: 10/03/2017
5
+
ms.date: 03/14/2019
6
6
ms.technology: vs-ide-general
7
7
ms.topic: conceptual
8
8
dev_langs:
@@ -16,17 +16,22 @@ ms.workload:
16
16
---
17
17
# Tutorial: Create a simple application with C\#
18
18
19
-
By completing this walkthrough, you'll become familiar with many of the tools, dialog boxes, and designers that you can use when you develop applications with Visual Studio. You'll create a "Hello, World" application, design the UI, add code, and debug errors, while you learn about working in the integrated development environment ([IDE](visual-studio-ide.md)).
19
+
By completing this tutorial, you'll become familiar with many of the tools, dialog boxes, and designers that you can use when you develop applications with Visual Studio. You'll create a "Hello, World" application, design the UI, add code, and debug errors, while you learn about working in the integrated development environment ([IDE](visual-studio-ide.md)).
20
20
21
+
::: moniker range="vs-2017"
21
22
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link&utm_content=download+vs2017) page to install it for free.
23
+
::: moniker-end
24
+
::: moniker range=">=vs-2019"
25
+
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link&utm_content=download+vs2019+rc) page to install it for free.
26
+
::: moniker-end
22
27
23
28
## Configure the IDE
24
29
25
-
When you start Visual Studio for the first time, you'll be prompted to sign in. This step is optional for this walkthrough. Next you may be shown a dialog box that asks you to choose your development settings and color theme. Keep the defaults and choose **Start Visual Studio**.
When you start Visual Studio for the first time, you'll be prompted to sign in. This step is optional for this tutorial. Next you may be shown a dialog box that asks you to choose your development settings and color theme. Keep the defaults and choose **Start Visual Studio**.
After Visual Studio launches, you'll see tool windows, the menus and toolbars, and the main window space. Tool windows are docked on the left and right sides of the application window, with **Quick Launch**, the menu bar, and the standard toolbar at the top. In the center of the application window is the **Start Page**. When you load a solution or project, editors and designers appear in the space where the **Start Page** is. When you develop an application, you'll spend most of your time in this central area.
32
37
@@ -36,7 +41,7 @@ After Visual Studio launches, you'll see tool windows, the menus and toolbars, a
36
41
37
42
::: moniker range=">=vs-2019"
38
43
39
-
When you launch Visual Studio, the **Start** window opens first. Select **Contine without code** to open the development environment. You'll see tool windows, the menus and toolbars, and the main window space. Tool windows are docked on the left and right sides of the application window, with **Quick Launch**, the menu bar, and the standard toolbar at the top. When you load a solution or project, editors and designers appear in the central space of the application window. When you develop an application, you'll spend most of your time in this central area.
44
+
When you launch Visual Studio, the **Start** window opens first. Select **Continue without code** to open the development environment. You'll see tool windows, the menus and toolbars, and the main window space. Tool windows are docked on the left and right sides of the application window, with **Quick Launch**, the menu bar, and the standard toolbar at the top. When you load a solution or project, editors and designers appear in the central space of the application window. When you develop an application, you'll spend most of your time in this central area.
40
45
41
46
::: moniker-end
42
47
@@ -46,20 +51,37 @@ When you create an application in Visual Studio, you first create a project and
46
51
47
52
1. Create a new project. On the menu bar, select **File** > **New** > **Project**.
48
53
54
+
::: moniker range="vs-2017"
49
55

56
+
::: moniker-end
57
+
::: moniker range=">=vs-2019"
58
+
[On the menu bar, choose File, New, Project](../media/vs-2019/exploreide-filenewproject-vs2019.png)
59
+
::: moniker-end
50
60
51
-
1. In the **New Project** dialog, select the **Installed** > **Visual C#** > **Windows Desktop** category, and then select the **WPF App (.NET Framework)** template. Name the project **HelloWPFApp**.
61
+
::: moniker range="vs-2017"
62
+
2. In the **New Project** dialog, select the **Installed** > **Visual C#** > **Windows Desktop** category, and then select the **WPF App (.NET Framework)** template. Name the project **HelloWPFApp**, and select **OK**.
52
63
53
64

65
+
::: moniker-end
66
+
::: moniker range=">=vs-2019"
67
+
2. On the **Create a new project** screen, search for "WPF," choose **WPF App (.NET Framework)**, and then choose **Next**.
54
68
55
-
1. Select **OK**.
69
+

56
70
57
-
Visual Studio creates the HelloWPFApp project and solution, and **Solution Explorer** shows the various files. The **WPF Designer** shows a design view and a XAML view of *MainWindow.xaml* in a split view. You can slide the splitter to show more or less of either view. You can choose to see only the visual view or only the XAML view. The following items appear in **Solution Explorer**:
71
+
3. At the next screen, give the project a name, **HelloWPFApp**, and choose **Create**.
72
+
::: moniker-end
58
73
59
-

74
+
Visual Studio creates the HelloWPFApp project and solution, and **Solution Explorer** shows the various files. The **WPF Designer** shows a design view and a XAML view of *MainWindow.xaml* in a split view. You can slide the splitter to show more or less of either view. You can choose to see only the visual view or only the XAML view. The following items appear in **Solution Explorer**:
60
75
61
-
> [!NOTE]
62
-
> For more information about XAML (eXtensible Application Markup Language), see the [XAML overview for WPF](/dotnet/framework/wpf/advanced/xaml-overview-wpf) page.
76
+
::: moniker range="vs-2017"
77
+

78
+
::: moniker-end
79
+
::: moniker range=">=vs-2019"
80
+

81
+
::: moniker-end
82
+
83
+
> [!NOTE]
84
+
> For more information about XAML (eXtensible Application Markup Language), see the [XAML overview for WPF](/dotnet/framework/wpf/advanced/xaml-overview-wpf) page.
63
85
64
86
After you create the project, you can customize it. By using the **Properties** window (found on the **View** menu), you can display and change options for project items, controls, and other items in an application.
65
87
@@ -81,7 +103,7 @@ We will add three types of controls to this application: a <xref:System.Windows.
81
103
82
104
### Add a TextBlock control
83
105
84
-
1.Open the **Toolbox** window by choosing the **View**menu and the**Toolbox** item.
106
+
1.Enter **Ctrl**+**Q** to invoke **Quick Launch** and type**Toolbox**. Choose **View > Toolbox** from the results list.
85
107
86
108
2. In the **Toolbox**, expand the **Common WPF Controls** node to see the TextBlock control.
87
109
@@ -107,7 +129,7 @@ The XAML markup should look something like the following example:
107
129
Text="Select a message option and then choose the Display button."
108
130
```
109
131
110
-
2. Center the TextBlock again if necessary, and save your changes by pressing **Ctrl**+**S** or using the **File** menu item.
132
+
2. Center the TextBlock again if necessary, and save your changes by pressing Ctrl+S or using the **File** menu item.
111
133
112
134
Next, you'll add two [RadioButton](/dotnet/framework/wpf/controls/radiobutton) controls to the form.
113
135
@@ -121,7 +143,7 @@ Next, you'll add two [RadioButton](/dotnet/framework/wpf/controls/radiobutton) c
121
143
122
144
Your window should look like this:
123
145
124
-

146
+

125
147
126
148
3. In the **Properties** window for the left RadioButton control, change the **Name** property (the property at the top of the **Properties** window) to `HelloButton`.
127
149
@@ -202,17 +224,15 @@ In this step, you'll find the error that we caused earlier by changing the name
Werenamed*MainWindow.xaml*to*Greetings.xaml*atthestartofthiswalkthrough, butthecodestillrefersto*MainWindow.xaml*asthestartupURIfor the application, so the project can't start.
235
+
Werenamed*MainWindow.xaml*to*Greetings.xaml*atthestartofthistutorial, butthecodestillrefersto*MainWindow.xaml*asthestartupURIfor the application, so the project can't start.
216
236
217
237
#### Specify Greetings.xaml as the startup URI
218
238
@@ -232,8 +252,6 @@ You can test the code during debugging by adding some breakpoints. You can add b
0 commit comments