• Stars
    star
    478
  • Rank 91,950 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Avalonia Templates for `dotnet new`

downloads Current stable version

Avalonia Templates for dotnet new

For more information about dotnet new templates see here.

Installing the templates

Run from a command line (.NET 7):

dotnet new install Avalonia.Templates

For .NET 6, the argument is --install:

dotnet new --install Avalonia.Templates

The templates should now be available in dotnet new list:

Template Name                        Short Name                 Language  Tags
-----------------------------------  -------------------------  --------  -----------------------------------------
Avalonia .NET App                    avalonia.app               [C#],F#   Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia .NET MVVM App               avalonia.mvvm              [C#],F#   Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia Cross Platform Application  avalonia.xplat             [C#],F#   Desktop/Xaml/Avalonia/Web/Mobile
Avalonia Resource Dictionary         avalonia.resource                    Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia Styles                      avalonia.styles                      Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia TemplatedControl            avalonia.templatedcontrol  [C#],F#   Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia UserControl                 avalonia.usercontrol       [C#],F#   Desktop/Xaml/Avalonia/Windows/Linux/macOS
Avalonia Window                      avalonia.window            [C#],F#   Desktop/Xaml/Avalonia/Windows/Linux/macOS

Note:

By default dotnet CLI would create a C# template,if you want to create F# template you will need to add -lang F# to the end of the command.

Creating a new Application

To create a new barebones application called MyApp in its own subdirectory, run:

dotnet new avalonia.app -o MyApp

Available parameters:

-f, --framework

Description: The target framework for the project.

Options: net6.0, net7.0

By default: net6.0

-av, --avalonia-version

Description: The target version of Avalonia NuGet packages.

Options: 0.10.21, 11.0.0-rc2.2

By default: 0.10.21

-cb, --compiled-bindings

Description: Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer). See documentation for more details.

Options: true, false

By default: true

--no-restore

Description: If specified, skips the automatic restore of the project on create.

Creating a new MVVM Application

MVVM is the recommended pattern for creating Avalonia applications. The MVVM application template uses ReactiveUI to ease building applications with complex interactions.

To create a new MVVM application called MyApp in its own subdirectory, run:

dotnet new avalonia.mvvm -o MyApp

Available parameters:

-f, --framework

Description: The target framework for the project.

Options: net6.0, net7.0

By default: net6.0

-av, --avalonia-version

Description: The target version of Avalonia NuGet packages.

Options: 0.10.21, 11.0.0-rc2.2

By default: 0.10.21

-cb, --compiled-bindings

Description: Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer). See documentation for more details.

Options: true, false

By default: true

-m, --mvvm

Description: MVVM toolkit to use in the template.

Options: ReactiveUI, CommunityToolkit

By default: ReactiveUI

-rvl, --remove-view-locator

Description: Defines if your app will use default ViewLocator made by Avalonia Team or you are planning to use a custom one. Removing ViewLocator may be useful in code trimming scenarios. Default ViewLocator is not trimming-friendly.

Options: true, false

By default: false

--no-restore

Description: If specified, skips the automatic restore of the project on create.

Creating a new Cross-Platform application

To create a new Cross-Platform application in its own subdirectory, run:

dotnet new avalonia.xplat 

Note: This type of template allows you to create an application that will work on Desktop, Browser and Mobile (iOS & Android). Only available with 11.0 preview versions.

Available parameters:

-cb, --compiled-bindings

Description: Defines if CompiledBindings should be enabled by default in the project. See documentation for more details.

Options: true, false

By default: true

-rvl, --remove-view-locator

Description: Defines if your app will use default ViewLocator made by Avalonia Team or you are planning to use a custom one. Removing ViewLocator may be useful in code trimming scenarios. Default ViewLocator is not trimming-friendly.

Options: true, false

By default: false

Creating a new Window

To create a new Window called MyNewWindow, in the namespace MyApp run:

dotnet new avalonia.window -na MyApp -n MyNewWindow

Creating a new UserControl

To create a new UserControl called MyNewView, in the namespace MyApp run:

dotnet new avalonia.usercontrol -na MyApp -n MyNewView

Creating a new Styles list

To create a new Styles list called MyStyles, run:

dotnet new avalonia.styles -n MyStyles

Creating a new ResourceDictionary

To create a new ResourceDictionary called MyResources, run:

dotnet new avalonia.resource -n MyResources

More Repositories

1

Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
C#
25,320
star
2

AvaloniaEdit

Avalonia-based text editor (port of AvalonEdit)
C#
716
star
3

Avalonia.Samples

Avalonia.Samples aims to provide some minimal samples focusing on a particular issue at a time. This should help getting new users started.
C#
570
star
4

Citrus.Avalonia

Modern styles for Avalonia controls.
C#
542
star
5

AvaloniaVS

Visual Studio Extension for Avalonia
C#
414
star
6

Live.Avalonia

In-app live reload for Avalonia applications.
C#
402
star
7

Avalonia.Xaml.Behaviors

Port of Windows UWP Xaml Behaviors for Avalonia Xaml.
C#
376
star
8

Avalonia.Markup.Declarative

Provides helpers for declarative ui in C#
C#
322
star
9

Avalonia.Controls.TreeDataGrid

A combined TreeView/DataGrid for Avalonia.
C#
268
star
10

Avalonia.Labs

Experimental Controls for Avalonia
C#
167
star
11

XamlControlsGallery

C#
159
star
12

AvaloniaMauiHybrid

Brings templated controls, pixel perfect rendering, animations, styling and composition to Maui
C#
152
star
13

AvaloniaUI.QuickGuides

C#
136
star
14

Avalonia.HtmlRenderer

Avalonia front-end for the HtmlRenderer project.
C#
112
star
15

AvaloniaVSCode

Visual Studio Code Extension for Avalonia UI
TypeScript
97
star
16

Avalonia.GIF

GIF image renderer and player for Avalonia UI Framework
C#
91
star
17

Avalonia.NameGenerator

Generates x:Name refs to Avalonia XAML controls.
C#
85
star
18

AvaloniaAutoGrid

C#
78
star
19

Avalonia.Essentials

Essential cross platform APIs for your mobile apps.
C#
65
star
20

Solitaire

C#
64
star
21

Wordle-onia

C#
60
star
22

ControlCatalogStandalone

C#
57
star
23

XamlPlayground

Avalonia Xaml Playground
C#
56
star
24

avalonia-docs

JavaScript
55
star
25

Documentation

AvaloniaUI documentation page source code
53
star
26

Avalonia.VSCodeExtension

This is an experimental VSCode extension. Don't expect it to work.
C#
50
star
27

Avalonia.MusicStore

C#
47
star
28

Avalonia-VSCode-Extension

An awesome extension for Visual Studio Code.
44
star
29

Avalonia.Lottie

Lottie/Bodymovin renderer and player for Avalonia UI Framework.
C#
29
star
30

Avalonia.AxamlAutoCompletion

C#
15
star
31

skiabuild

Makefile
6
star
32

MusicStoreTutorial

C#
6
star
33

Avalonia.TagsAndIdentation

TypeScript
5
star
34

NodeEditor

CSS
4
star
35

Avalonia.WebCam

Experimental cross-platform webcam interface for Avalonia UI Framework.
C#
3
star
36

Avalonia.Toolkit

2
star
37

.github

2
star