Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastassiaP committed Jun 5, 2024
1 parent 83acbb2 commit adfbe40
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/get-started/test-drive/add-a-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Avalonia contains a built-in control that creates a button. Follow this procedur
- Stop the app if it is running.
- Locate the
`<TextBlock Text="text" HorizontalAlignment="Center" VerticalAlignment="Center"/>`
in the `MainView.axaml` file..
in the `MainWindow.axaml` file..
- Delete the entire line.
- Insert a 'Button' tag as shown:
```xml
Expand Down
9 changes: 4 additions & 5 deletions docs/get-started/test-drive/main-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ In the **MainWindow.axaml** XAML file, the `<Window>...</Window>` XAML tag repre

<img src={LayoutZonesDiagram} alt="" />

In the current application, the content zone of the window references another view: **<views:MainView />**. This is a reference to the **MainView.axaml** file, which is a user control that will be displayed in the content zone of the window.

## The MainView User Control
## The MainWindow control

Inside this user control, you will see a `<TextBlock>...</TextBlock>` XAML tag. This represents a text block control. The `Text` property of the text block is bound to the **Greeting** property of the **MainViewModel** class. This is a property that will be set in the constructor of the view model class.
Inside **MainWindow.axaml**, you will see a `<TextBlock>...</TextBlock>` XAML tag. This represents a text block control. The `Text` property of the text block is bound to the **Greeting** property of the **MainWindowViewModel** class. This is a property that will be set in the constructor of the view model class.

This comment has been minimized.

Copy link
@LukeRJamieson

LukeRJamieson Jul 27, 2024

Contributor

Incorrect. This is in MainView.axaml

```
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
```

You can change the text in the file **MainViewModel.cs** to see the change reflected in the user interface.
You can change the text in the file **MainWindowViewModel.cs** to see the change reflected in the user interface.

This comment has been minimized.

Copy link
@LukeRJamieson

LukeRJamieson Jul 27, 2024

Contributor

Incorrect. This is in MainViewModel.cs


<img className="center" src={ViewModelScreenshot} alt="" />
<img className="center" src={AppRunningScreenshot} alt="" />
Expand All @@ -42,7 +41,7 @@ For more information about the concept of control layout zones, see [here](../..
## The Visual Studio Designer

If you're using Visual Studio you should see the XAML code and preview pane.
Navigate to the **MainView.axaml** file and click the **Split View** button at the top of the editor window.
Navigate to the **MainWindow.axaml** file and click the **Split View** button at the top of the editor window.

This comment has been minimized.

Copy link
@LukeRJamieson

LukeRJamieson Jul 27, 2024

Contributor

This screenshot literally shows that the file is MainView.axaml. How did this get merged?


<img className="center" src={VsPreviewerScreenshot} alt="" />

Expand Down
Binary file modified static/img/get-started/test-drive/calculate-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/get-started/test-drive/main-window-viewmodel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

6 comments on commit adfbe40

@mini-batch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New to Avalonia, just going through the test drive section of the docs. As @LukeRJamieson has noted, these changes all appear to be wrong. I installed the Avalonia for Visual Studio 2022 extension and created an "Avalonia C# Project" as instructed in the previous docs page. The pre-commit version of the docs is correct for my setup.

@stevemonaco
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you have an older version of the project templates or AvaloniaVS. Created through the CLI (dotnet new avalonia.mvvm -o GetStartedApp), you should see the following:

image

You can update templates via dotnet new install Avalonia.Templates (current version 11.1.0).

There were previously differences between VS-specific templates included through the extension and the ones provided by avalonia-dotnet-templates but the VS-specific templates should been removed from the extension as of AvaloniaVS 11.6.

@mini-batch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stevemonaco, I will confirm if this is the case when I next get a chance.

@mini-batch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevemonaco
In the Visual Studio tab in the Create the Project section, an Avalonia C# Project is created. Using version 11.7 of the Avalonia for Visual Studio 2022 extension, this creates the following:
avalonia-c#-project

Selecting the Avalonia Cross Platform Application template instead leads to the following, which looks consistent with a project created by dotnet new avalonia.mvvm -o GetStartedApp:
avalonia-cross-platform-application

The Visual Studio sections in this part of the docs appear to be using the former project template, which has led to the confusion. Should the docs be updated to use the Avalonia Cross Platform Application template, or does the Avalonia C# Project template still need to be updated for consistency?

@stevemonaco
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. That image wasn't updated under the VS tab. IMO, we should be recommending the MVVM template instead of the wizard-based one as it brings in unnecessary project fragmentation for a guide. Which would then be consistent with this commit's project structure.

ie. This template:

image

@mini-batch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help @stevemonaco. I have submitted a pull request (#538) with changes addressing this.

Please sign in to comment.