Shell, Visual and CollectionView are the new features highlighted in the new version of Xamarin.Forms 4.0. You can see more about this update here.
In case, if you did not find out, this publication belongs to the first #XamarinMonth where a calendar is shared with recent content from incredible authors that will make you blow your mind. If you have not seen it yet, you can see it here.
The Future of Xamarin Forms
Nowadays there is a lot of talk about the new feature incorporated in Xamarin forms 4.0 called Shell. The truth is the concept that arises with Shell to handle all the navigation is simply impressive. But still I think that Xamarin Forms Visual is the beginning of the future of Xamarin Forms.
Over time, and with the great advances that some development tools have had, we have had the opportunity to see the simplicity in which some processes are automated, making our lives easier.
In the same way, we are seeing how the tools are innovating in the concept of how to create beautiful user interfaces (UI) for users in a simple and intuitive way. It is well known that most developers do not stand out for their design skills. Therefore, when (in the first instance) they give us this facility, we will simply love the tool because it is helping us in that weak point we have.
This is where Xamarin Forms Visual makes sense. Visual is the new feature within Xamarin Forms 4.0 that allows developers to create more consistent views between platforms based on Google’s design patterns called Material Design. While it is true, Google has marked the standard at the level of mobile application design.
Incorporating this characteristic or the base point has great significance. On one hand, we are seeing how Xamarin does not want to be left behind with the new trends. And on the other hand, we can see as always Xamarin’s team is watching the community to give us what we really need.
The mobile applications development with styles based on the material design patterns are very common nowadays. The truth is that these have been well accepted by end users, so much so that it has been marked as a standard at the level of mobile application design (or so it seems).
Visual came to Xamarin forms to provide developers the ability to create beautiful native applications in a very easy and simple way base on styles.
How it works
The way in which Visual currently works is adding a theme where you define which styles you want your controls to inherit. In this case, we have the theme that comes by default and the material design. We can set this property globally or directly in our controls.
Let’s see a small example:
The rendering of controls works by inheritance, this means that when setting the Visual property in Material all the elements supported by visual within the contentPage will be rendered.
Here is a comparison between the rendered and normal controls:
Details to consider
Controls and affected views are only available for Android and iOS. In the first preview they only showed us the following supported controls / views:
Although in this firts view there are not many, but it is a great start for the rendering of new controls in the near future. In the same way, it supposes great added value for the whole community, especially for those who do not handle the design aspect.
With Visual now we will have to make less effort to achieve UIs incredibly nice for users. It’s good to remember that Visual is in Preview. This means that we must install the nuget Xamarin Forms Preview packages.
To use Visual in its preview version it is necessary to add the following line of code in the AppDelegate class in iOS, as well as in the MainActivity class in Android, before calling Forms.Init:
Note: In iOS, it is necessary to add the NuGet Xamarin.iOS.MaterialComponents package. Visual requires API 29 to run on Android.
The operation of Visual is more or less based on applying styles. With this I see as an initiative that makes something bigger. Visual arrives to create the basis of new features based on patterns of designs.
I think the next step is to create controls or features based on design patterns (material design for example) such as the handling of transitions between elements, handling of animations, etc. The community would love it!
I think we can create a trend on twitter to make the call to action to Xamarin’s team under the hashtags #Xamarin #VisualControls. What do you think? Let’s create a trend, give us your like and retweet the tweet below or just create a new one, the Xamarin team always listens to the community. And we have nothing to lose.
I will tag you 💪
— Luis Matos (@luismatosluna) February 12, 2019
For now we can only wait for the stable version of Xamarin Forms 4.0 where we can test more thoroughly the advances on Visual. We hope that they include more supported controls and at the same time that they include more topics besides material, it would be interesting to see different patterns of designs.
See you next time!
Thank you somuch for reading this post!