Skip to content

MAUI application template following the principles of Clean Architecture

License

Notifications You must be signed in to change notification settings

hflexgrig/MAUI---CleanArchitecture

Repository files navigation

MAUI---CleanArchitecture

MAUI application template following the principles of Clean Architecture

WORK CURRENTLY IN PROGRESS

MAUI.CleanArchitecture.2021-12-13.07_35_12_Trim.mp4

Technologies

Description

This is sample EShop app. It retrieves data from Fake Store API once, stores it into local SQLite database, consequent times it takes only from local storage. ASPNet Identity authentication used to create new user and sign in.

Keep {viewname}View {viewModelName}ViewModel naming conventions, as assembly scanners from ViewModelLocator will be able to locate and assign BindingContext to it's view. Also on some views don't forget to add

<ContentPage x:Class="MAUI.CleanArchitecture.Views.LoginPageView" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:viewModelBase="clr-namespace:MAUI.CleanArchitecture.ViewModels.Base" viewModeBase:ViewModelLocator.AutoWireViewModel="True" This will help ViewModelLocator to find viewModel and set BindingContext

        private static void OnAutoWireViewModelChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var view = bindable as Element;
            if (view is null) return;

            var viewType = view.GetType();
            
            if (!ViewToViewModelDict.TryGetValue(viewType, out var viewModelType))
            {
                return;
            }

            var viewModel = ServiceProvider.GetService(viewModelType);

            view.BindingContext = viewModel;
        }

About

MAUI application template following the principles of Clean Architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages