Skip to content
Dan Lorenz edited this page Nov 7, 2023 · 17 revisions

Shield MVVM

Protects you with type-safety, everywhere

CoreBTS's ShieldMVVM is a .NET MAUI MVVM framework that provides type-safety for navigation, bindable properties, converters, behaviors, dialogs, data templates, and more in a way that enables developers to code faster, safer, and with less lines.

This wiki will go over all the concepts and support that Shield MVVM brings to developers. If you have any questions, please don't hesitate to ask!

By wrapping Microsoft MAUI's navigation, developers can do ViewModel-to-ViewModel navigation. Developers can also pass typed arguments to send data to the next ViewModel and even a typed result back when the user navigates back. The code can await where the navigation took place and the result will come back to that spot in code.

See more...

With the help of the MAUI CommunityToolkit, developers can create dialog ViewModels and show them from a page ViewModel via the Navigation service. These dialogs can have full XAML support with full bindings as if they were a normal page. They can be built just like any other page and you can get a result back from showing them in a similar way to normal pages inside ShieldMVVM.

See more...

In MAUI, Bindable Properties are how all the one-way and two-way bindings get hooked up, but they are not type-safe. ShieldMVVM wraps them in a type-safe/generic version of BindableProperty to guarantee the developer is binding the correct types. All the "Bind" methods will show up in intellisense that only apply to the control you are binding and can be chained together. If a developer attempts to bind a different type, the code will not compile. However, a converter can be used inline where Intellisense shows only the possible combinations for the given types.

See more...

Converters allow a developer to convert a value from a ViewModel into a more UI friendly version. ShieldMVVM comes with type-safe/generic converters to speed up development. The basic implementation allows callbacks to be used, so developers don't have to create new classes every time. Since they are generic, they can be used to support Intellisense in code-behind bindings by making them extension methods. Finally, since these are callbacks, developers can send any number of type-safe parameters into the call in order to do the conversion - developers are not limited to just one parameter of type object.

See more...

Similar to converters, Behaviors are also made type-safe/generic. They can be chained with the Bindable Properties in order to add additional functionality. Intellisense will only show you the behaviors that apply to the control you are binding to.

See more...

See more...

Some controls, like labels, don't have the ability to bind clicks out of the box. ShieldMVVM exposes a generic bind method to easily wrap any control that allows for gestures. This way, developers can add BindClick to almost any control directly.

See more...

Clone this wiki locally