Skip to content

Commit 9f05d1e

Browse files
added vscode to getting started guide
1 parent 64dc08e commit 9f05d1e

14 files changed

+45
-16
lines changed

docs/basics/user-interface/adding-interactivity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The simplest way of using commands is to bind to a method in the object's data c
5353

5454
1. **Add a method to the view model**: Define a method in a view model which will handle the command.
5555

56-
```csharp
56+
```csharp title='C#'
5757
public class MainWindowViewModel
5858
{
5959
// highlight-start
@@ -67,6 +67,6 @@ The simplest way of using commands is to bind to a method in the object's data c
6767

6868
2. **Bind the Method**: Associate the method with the control that triggers it.
6969

70-
```xml
70+
```xml title='XAML'
7171
<Button Content="Click Me" Command="{Binding HandleButtonClick}" />
7272
```

docs/basics/user-interface/assets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Avalonia UI has built-in converters which can load assets for bitmaps, icons and
7070

7171
You can write code to load assets using the `AssetLoader` static class. For example:
7272

73-
```csharp
73+
```csharp title='C#'
7474
var bitmap = new Bitmap(AssetLoader.Open(new Uri(uri)));
7575
```
7676

docs/basics/user-interface/code-behind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace AvaloniaApplication1.Views
8787

8888
With the control reference available in the code-behind, you can set properties. For example, you can change the background property like this:
8989

90-
```csharp
90+
```csharp title='C#'
9191
greetingButton.Background = Brushes.Blue;
9292
```
9393

docs/get-started/install.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The best way to get started with Avalonia is by creating an application using a
1414

1515
To install the [Avalonia templates](https://github.com/AvaloniaUI/avalonia-dotnet-templates), run the following command:
1616

17-
```bash
17+
```bash title='Bash'
1818
dotnet new install Avalonia.Templates
1919
```
2020

@@ -24,7 +24,7 @@ For .NET 6.0 and earlier, replace `install` with `--install`
2424

2525
To list the installed templates run
2626

27-
```bash
27+
```bash title='Bash'
2828
dotnet new list
2929
```
3030

@@ -47,13 +47,13 @@ Avalonia Window avalonia.window [C#],F
4747

4848
Once the project templates are installed, you can create a new _Avalonia UI_ application from CLI by running the following command:
4949

50-
```bash
50+
```bash title='Bash'
5151
dotnet new avalonia.app -o MyApp
5252
```
5353

5454
This will create a new folder called `MyApp` containing your application files. To run the application, navigate to the `MyApp` folder and run:
5555

56-
```bash
56+
```bash title='Bash'
5757
cd MyApp
5858
dotnet run
5959
```

docs/get-started/test-drive/add-a-control.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ So far, the main window of your application displays only a text string. On this
1414
Avalonia contains a built-in control that creates a button. Follow this procedure to replace the text string currently in the `Window`'s content zone with a button control.
1515

1616
- Stop the app if it is running.
17-
- Locate the
18-
`<TextBlock Text="text" HorizontalAlignment="Center" VerticalAlignment="Center"/>`
17+
- Locate
18+
```xml title='XAML'
19+
<TextBlock Text="text" HorizontalAlignment="Center" VerticalAlignment="Center"/>
20+
```
1921
in the `MainView.axaml` file..
2022
- Delete the entire line.
2123
- Insert a `Button` tag as shown:
22-
```xml
24+
```xml title='XAML'
2325
<Button>Calculate</Button>
2426
```
2527
<img className="center" src={CalculateButton} alt="" />
@@ -42,7 +44,7 @@ procedure to set the `HorizontalAlignment` to centered instead.
4244

4345
- Add a new attribute to the Button tag as follows:
4446

45-
```xml
47+
```xml title='XAML'
4648
<Button HorizontalAlignment="Center">Calculate</Button>
4749
```
4850

docs/get-started/test-drive/create-a-project.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ import VsNewAvaloniaProjectScreenshot from '/img/get-started/test-drive/vs-new-a
1313
import RiderRunScreenshot from '/img/get-started/test-drive/rider-run.png';
1414
import InitialWindowScreenshot from '/img/get-started/test-drive/initial-window.png';
1515

16+
import vscode1 from '/img/get-started/test-drive/vscode-command-new-project.png';
17+
import vscode2 from '/img/get-started/test-drive/vscode-select-project-template.png';
18+
import vscode3 from '/img/get-started/test-drive/vscode-name-new-project.png';
19+
import vscode4 from '/img/get-started/test-drive/vscode-create-project.png';
20+
import vscode6 from '/img/get-started/test-drive/vscode-select-csharp.png';
21+
import vscode7 from '/img/get-started/test-drive/vscode-launch-app.png';
22+
import vscode8 from '/img/get-started/test-drive/vscode-app-running.png';
23+
24+
1625
## Install Templates
1726

1827
Before starting, ensure that you have [installed the Avalonia templates](../install.md):
1928

20-
```bash
29+
```bash title='Bash'
2130
dotnet new install Avalonia.Templates
2231
```
2332

@@ -29,7 +38,7 @@ To get started, we're going to use the MVVM Avalonia template: `Avalonia MVVM Ap
2938
<TabItem value="cli" label="Command Line" default>
3039
Run the command:
3140

32-
```bash
41+
```bash title='Bash'
3342
dotnet new avalonia.mvvm -o GetStartedApp
3443
```
3544

@@ -69,6 +78,17 @@ The template will create a new solution and two new projects. `GetStartedApp` is
6978
<img className="center" src={VsNewAvaloniaProjectScreenshot} />
7079

7180
</TabItem>
81+
82+
<TabItem value="vsc" label="Visual Studio Code">
83+
* Bring up the Command Palette using `⇧ ⌘ P` and then type ".NET" and find and select the **.NET: New Project** command.
84+
<img className="center" src={vscode1} />
85+
* After selecting the command, you'll need to choose the project template. Choose **Avalonia MVVM app**.
86+
<img className="center" src={vscode2} />
87+
* Name the project G`etStartedApp`, and press enter.
88+
<img className="center" src={vscode3} />
89+
* You'll need to provide a path for where the project should be created. Do this, and then press **Create project**
90+
<img className="center" src={vscode4} />
91+
</TabItem>
7292
</Tabs>
7393

7494
## Run the Project
@@ -79,7 +99,7 @@ We're now ready to run the project!
7999
<TabItem value="cli" label="Command Line" default>
80100
Go into the `GetStartedApp` directory and run:
81101

82-
```bash
102+
```bash title='Bash'
83103
dotnet run
84104
```
85105
</TabItem>
@@ -97,6 +117,13 @@ Press the **Run** button in the Rider toolbar:
97117
Hit `F5` to run the project.
98118

99119
</TabItem>
120+
121+
<TabItem value="vsc" label="Visual Studio Code">
122+
* Hit `F5` to run the project and Select `C#` as the debugger
123+
<img className="center" src={vscode6} />
124+
* Select **C#: GetStartedApp Demo** to launch the application with the debugger connected.
125+
<img className="center" src={vscode7} />
126+
</TabItem>
100127
</Tabs>
101128

102129
The solution will build and run.

docs/get-started/test-drive/main-window.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Inside this user control, you will see a `<TextBlock>...</TextBlock>` XAML tag.
3232
`Text` to the screen. The `Text` property of the `TextBlock` is bound to the **Greeting** property of
3333
the **MainViewModel** class.
3434

35-
```
35+
```xml title='XAML'
3636
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
3737
```
3838

Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)