Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exendahal/avalonia_new
Starter template for building mobile applications using Avalonia.
https://github.com/exendahal/avalonia_new
android avalonia dotnet ios maui wasm wpf
Last synced: 2 months ago
JSON representation
Starter template for building mobile applications using Avalonia.
- Host: GitHub
- URL: https://github.com/exendahal/avalonia_new
- Owner: exendahal
- Created: 2024-06-16T08:24:25.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-23T14:33:04.000Z (6 months ago)
- Last Synced: 2024-09-29T21:54:25.843Z (3 months ago)
- Topics: android, avalonia, dotnet, ios, maui, wasm, wpf
- Language: C#
- Homepage:
- Size: 437 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Avalonia Boilerplate
Welcome to the Avalonia Boilerplate repository! This project serves as a starter template for building mobile applications using Avalonia. It is designed to help beginners set up a mobile application environment with ease, providing essential features and a clean architecture based on the MVVM pattern with Prism.Avalonia. This boilerplate includes navigation, font icons, SVG support, and a toast notification service.
## Features
- **MVVM Pattern with Prism.Avalonia**: Clean separation of concerns with the MVVM architecture.
- **Navigation**: Easy and intuitive navigation system.
- **Font Icons**: Support for font icons to enhance the UI.
- **SVG Support**: Integration for SVG images.
- **Toast Service**: Built-in service for displaying toast notifications.## Getting Started
Follow these steps to get your project up and running.
### Prerequisites
- [.NET SDK](https://dotnet.microsoft.com/download)
- [Visual Studio](https://visualstudio.microsoft.com/vs/) or [Visual Studio Code](https://code.visualstudio.com/)### Installation
1. **Clone the repository:**
```bash
git clone [email protected]:exendahal/avalonia_new.git
cd avalonia_new
```2. **Restore dependencies:**
```bash
dotnet restore
```3. **Build the project:**
```bash
dotnet build
```4. **Run the application:**
```bash
dotnet run
```## Project Structure
- **/avalonia_new**: Contains the main application code.
- **/Views**: XAML files for UI components.
- **/ViewModels**: C# files for view models.
- **/Models**: Data models.
- **/Services**: Implementation of services (e.g., toast notifications).
- **/Resources**: Contains fonts, SVGs, and other resources.## Using the MVVM Pattern
This boilerplate follows the MVVM pattern using Prism.Avalonia. Here's a brief overview:
### ViewModel
Create your ViewModels in the `/ViewModels` directory. Here's an example of a simple ViewModel:
```csharp
public class MainViewModel : BindableBase
{
private string _title = "Hello, Avalonia!";
public string Title
{
get => _title;
set => SetProperty(ref _title, value);
}
}
```### View
Create your Views in the `/Views` directory and bind them to ViewModels. Here's an example of a simple View:
```xml
```
### Navigation
Use Prism's navigation service to handle navigation between views.
### Font Icons and SVG Support
Add your font icons and SVG images to the `/Resources` directory and reference them in your views.
### Toast Service
To use the toast service, call the ShowToast method with a message and toast type. Available toast types are Success, Warning, and Failed:
```csharp
ToastHelper.ShowToast("Welcome", Services.ToastService.ToastType.Success);
```## Acknowledgments
- [Avalonia](https://avaloniaui.net/)
- [Prism.Avalonia](https://github.com/AvaloniaCommunity/Prism.Avalonia)---
Thank you for using the Avalonia Mobile Boilerplate! If you have any questions or feedback, feel free to open an issue or submit a pull request. Happy coding!