Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevemonaco/avaloniaviewmodelfirstdemos
Demonstrates ViewModel-First MVVM scenarios with Avalonia
https://github.com/stevemonaco/avaloniaviewmodelfirstdemos
Last synced: 9 days ago
JSON representation
Demonstrates ViewModel-First MVVM scenarios with Avalonia
- Host: GitHub
- URL: https://github.com/stevemonaco/avaloniaviewmodelfirstdemos
- Owner: stevemonaco
- License: mit
- Created: 2023-07-25T06:27:27.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-26T00:24:11.000Z (over 1 year ago)
- Last Synced: 2023-07-26T00:25:25.704Z (over 1 year ago)
- Language: C#
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AvaloniaViewModelFirstDemos
Various demos that use ViewModel-First MVVM in Avalonia. This means that the ViewModel is always created first and the View is resolved/created based on the ViewModel's type or shape. Approaches typically include some combination of a ViewLocator, `ContentControl`s, and `DataTemplate`s.
## AOT-friendly ViewLocators
Currently, these demos have equal functionality, but have different technical implementations. Service registration for dependency injection has traditionally been reflection-heavy, and these demos show newer source generator approaches to eliminate that problem. This opens up trimming and Ahead-Of-Time compilation support while keeping ViewModel-First support with ViewLocator. The ViewLocator could be enhanced for broader view-caching or alternatively skipped altogether to instead define every ViewModel -> View mapping as a `DataTemplate` in XAML.
![Demo Screenshot](AvaloniaCommunityToolkitAot/DemoImages/Screenshot.png)
### AvaloniaCommunityToolkitAot
Demonstrates how to use the lab preview of [CommunityToolkit.Extensions.DependencyInjection](https://github.com/CommunityToolkit/Labs-Windows/discussions/463) with `Microsoft.Extensions.DependencyInjection` to create an AOT-friendly ViewLocator.
This package currently requires the [Toolkit Labs preview feed](https://github.com/CommunityToolkit/WindowsCommunityToolkit/wiki/Preview-Packages#toolkit-labs-)
### AvaloniaJabAot
Demonstrates how to use [Jab](https://github.com/pakrym/jab) to create an AOT-friendly ViewLocator.