As a continuation of my last post, I want to further discuss the concept of mobile search inside of Xamarin.Forms. While search performance is important throughout the search lifecycle, UI responsiveness is essential to a positive user experience. Initially, when trying to add search to an application, I started with a ListView and an ObservableCollection that would swap items out of the list when a search was run. This proved to be a poor user experience.
Lately, I’ve been thinking a lot about search in mobile applications and realized just how hard it can be. There are quite of few things to consider when adding search. For example, performance, user interaction, and data, just to name a few. As such, I think I have some good topics to blog about in the future. In the meantime, let’s start with figuring out how to use a native iOS search entry in the navigation bar of a Xamarin.
In my previous post, I talked about using BindableLayout extensions with other Layout types, including the FlexLayout. The BindableLayout is extremely useful when working with a collection of items; however, these layouts are missing touch events and commands. In order to add this missing functionality, we can create a custom Behavior. Behaviors are great when you want to add functionality to an existing Xamarin.Forms control, without subclassing. So if I wanted to do a validation on an Entry or add touch events to a FlexLayout, a Behavior would be a great option.
In Xamarin.Forms 3.5 the BindableLayout was introduced in order to provide functionality similar to a “repeater.” In nearly every Xamarin project I’ve worked on, I’ve needed a repeater of some sort. So, I’d usually create a custom control for this, which would take an ItemsSource and an ItemTemplate, but I don’t have to anymore. This functionality was introduced in Xamarin.Forms 3.5. While many of the use cases I was solving for with my own “repeater” can now be solved by the Bindable StackLayout, I feel like we are overlooking that the BindableLayout isn’t just for the StackLayout.
Starting in Xamarin.Forms 4.0 there is a new element called the CollectionView. According to the Xamarin team, this new element should replace the well known control ListView. The CollectionView is intended to be a successor to the ListView, improving upon its design by reducing technical complexity and allowing for more flexibility of layout and function I recently started to look at the CollectionView (in version 220.127.116.11046-pre5), and noticed one thing missing: item spacing.
Ever wonder where to place activity indicators in your mobile apps? Quite often, I find myself placing the indicator right on the button itself. One of the benefits of such a design, is that you don’t have to free up any screen real estate to show the indicator. Here is an example of what I am talking about: Personally, I think this is a clean and simple design. So let’s see how we can achieve this using just Xamarin.
TabbedPages in mobile apps are probably something we are all familiar with. From a user’s point of view, they are a logical separation of ideas or tasks. I recently found myself needing to implement a TabbedPage using Xamarin.Forms and Prism, but I was doing something out of the ordinary. I needed to share context between both of my pages. Basically, I wanted to allow users to input information in one of two ways.
I recently started a new Xamarin.Forms project. Being new to mobile development, I started by researching best practices for an “enterprise application.” By this, I mean I was looking for frameworks that support maintainability, testability, and generally encourage development best practices. While I’ve never created more than a “Hello World” application in Xamarin, I quickly learned about MVVM, and was reminded of some of the benefits of dependency injection. After playing around with a couple frameworks, I settled on using Prism.