Migration

Migrating Animations from Xamarin Forms to Uno Platform

Share on twitter Share on linkedin Share on reddit Animations are crucial in making any user interface more engaging and dynamic, regardless of complexity. This article will delve into the process of migrating animations from Xamarin Forms to Uno Platform This article will delve into the process of migrating animations from Xamarin Forms to Uno Platform, a question we get asked reasonably frequently, so we are documenting it for ease of access. Furthermore, we’ll look at simpler and more complex animations such as the ones below, highlight the differences between the two platforms, and provide the necessary steps to make the process seamless and practical. By the end of this article, you’ll better understand how to create animations that work seamlessly across multiple platforms. Getting Animated Even the simplest animations can help bring your user interface to life. Xamarin Forms uses a set of extension methods provided by the ViewExtensions class to animate a common set of UI element properties. Under the hood, these are powered by the Animation class, which allows you to define custom animations on other properties. This uses callback functions which define the property change itself. The Animation is created with an easing function and will

Migrating a Custom-Drawn Xamarin Forms Control to Uno Platform

Share on twitter Share on linkedin Share on reddit In a previous blog post, we explored porting a Xamarin Forms control which was made up of standard XAML elements over to Uno Platform. This time we will investigate a custom-drawn control and provide source code for it. While there are many ways to custom-drawn controls, the main implementation you will come across on a multi-platform Xamarin Forms control is SkiaSharp. SkiaSharp is a cross-platform .NET API based on the Skia 2D graphics library. Skia was created by Google but is available on all mainstream platforms and so you can create drawing code which works across devices regardless of their specific implementation. SkiaSharp therefore runs across all .NET mobile and desktop platforms. When building a custom control for Xamarin Forms you can use the SKCanvasView. This provides a View which contains the OnPaintSurface method which you implement in your derived class to draw to the screen. The method arguments contain to the SKSurface which represents the raw surface you can draw to. The SKCanvasView handles resizing and will call your OnPaintSurface method to redraw as required. Your code will consider the size of the surface as you should expect this to

Migrating Custom Controls from Xamarin Forms to Uno Platform

Share on twitter Share on linkedin Share on reddit As Xamarin.Forms inches closer to the end of support, you may consider your options for migrating your mobile applications and maybe even custom controls for your ‘old’ Xamarin.Forms app, which you need to bring with you. In this article, we will work through migrating the CardView demo originally provided as one of the sample apps in Xamarin.Forms repo to an Uno Platform app to show you how easy it is to port Xamarin.Forms apps to Uno Platform. Uno Platform | Xamarin.Forms The CardView is a sample control based on Xamarin.Forms’ ContentView and is designed to display an image, header and body text in a card format (often used in a list). Anatomy of a Custom Control A custom control consists of two files – the XAML file defining the UI and a code-behind file which contains some boilerplate code and any custom properties you have defined for the control. The class for your control inherits from ContentView and is marked as partial because some functionality is added by compiler-generated code. The standard empty class contains a constructor with a call to InitializeComponent. As with pages (and any other XAML-based class), this calls