Andrew Hoefling

Speaker | Mentor | Coder | Leader

When building cross-platform apps using Uno Platform it is a common technique to use the Model-View-ViewModel (MVVM) architecture. This is a way to separate out your User Interface logic from the business rules that power the page. A ViewModel is a special class that provides data binding to the View. Many MVVM frameworks provide a pre-built ViewModelLocator. This article goes over how to build a custom ViewModelLocator for your project.

When implementing a Model-View-ViewModel (MVVM) pattern in Uno Platform projects is similar to any other XAML Page based toolchain such as WPF and Xamarin.Forms for example. You unlock the power of MVVM once you implement a Dependency Injection solution as it simplifies all of your ViewModel dependencies. Microsoft has a great community library for Dependency Injection called Microsoft.Extensions.DependencyInjection.

When building cross-platform apps using Uno Platform it is a common problem to run platform specific code. You may have the same User Interface action but the code needs to execute native APIs or just respond differently depending on the different business rules. Uno Platform provides easy to use pre-processor directives to make this easy to use.

When building cross-platform applications one of the most important features is platform specific features. Such as rendering particular controls on Android vs iOS vs WASM vs UWP vs etc. This gives the application developer the most control to conform to platform design best practices but work in a 100% shared code. Uno Platform has a very impressive API access for platform specific rendering, even in the XAML you can define controls that will only render on the platforms you want.

Tabbed pages is a best practice in modern application development which holds true especially for the smaller form factors such as mobile apps. Uno Platform is a UWP bridge for building cross platform apps in Windows, iOS, Android, MacOS, Web Assembly, and more. There are predefined controls built into the UWP library and WinUI that simplify this task, which enables you the developer to worry about business rules.

Uno Platform creates a WinUI bridge to build cross-platform applications for Windows, iOS, Android and Web Assembly. Each platform has a different technique for handling navigation. Using the UWP specifrication you can easily create a View Statck style of navigation that has a consistent look and feel across the different platforms.

Uno Platform is a cross-platform app development platform that uses C# and the Universal Windows Platform (UWP) to allow developers to build powerful apps for iOS, Android, Windows and the Web. In other words it is a WinUI bridge that enables developers to take their existing UWP skills to the other platforms. 

Dependency Injection is a great technique to leveraging native code in the context of your shared code. In Xamarin.Forms you typically create a custom renderer which gives you native access. If you need to run some native code from the shared context you can easily do this with the built-in Dependency Injection tooling.

Xamarin.Forms provides a simple control for adding tabs to any application but the standard implementation has some limitations. With a little knowledge of how iOS and Android work you can start creating beautiful Tabs in your Xamarin.Forms applications that support custom colors and custom text.

Azure Mobile App Services sets you up with a nice template builds all of your boiler plate code. When I went through the setup on the Azure Portal and downloaded the template locally I ran into all sorts of issues with iOS not working in my Xamarin.Forms project. Everything appears to work without issue on Android but I couldn’t get the MobileServiceClient to load, the app would just crash. After lots of digging and playing with the tools provided I figured out what was wrong. It appears the template was missing some platform specific code for iOS.