No description
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| Demo | ||
| ViewHelper | ||
| ViewHelper.Avalonia | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| renovate.json | ||
| ViewHelper.sln | ||
| ViewHelper.sln.DotSettings | ||
NOTE
Content of this repo will be split in multiple repos -> See Avalon repos.
ViewHelper
This library provides simple implementations for view locating and animated navigation within AvaloniaUI applications.
Features
ViewLocator
// Create the ViewLocator - a service locator may be passed optionally
var locator = new AvaloniaViewLocator();
// Resolve view
var view = locator.ResolveView<MainView, MainViewModel>()
Navigation
// Usage within another ViewModel:
// Push the resolved view
Navigation.PushAsync(view)
Available methods
- PushAsync
- PopAsync
- PopToRootAsync
- SetRootAsync
Passing data on navigation
To pass data to another object when navigating, pass an instance of NavigationData (or custom implementation of INavigationData) to one of the available navigation methods.
The target object must either implement the INavigable or the IElementWithVm interface.
Initialization
Ensure that .UseViewHelper() is invoked as part of your AppBuilder initialization to activate the library’s functionality.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseViewHelper() // <- Add this line
.WithInterFont()
.LogToTrace();
License
MIT