-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong. |
||
``` | ||
<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.
Sorry, something went wrong. |
||
|
||
<img className="center" src={ViewModelScreenshot} alt="" /> | ||
<img className="center" src={AppRunningScreenshot} alt="" /> | ||
|
@@ -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.
Sorry, something went wrong.
LukeRJamieson
Contributor
|
||
|
||
<img className="center" src={VsPreviewerScreenshot} alt="" /> | ||
|
||
|
6 comments
on commit adfbe40
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
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
:
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
Incorrect. This is in MainView.axaml