In this article, you will learn how to use a Bindable Layout in Xamarin.Forms.

Xamarin.Forms is an open-source UI framework that runs on multiple platforms with a single shared codebase. It allows developers to create user interfaces in XAML with code-behind in C#. These interfaces are rendered as performant native controls on each platform.
Bindable Layout
If you are someone who is looking for a lightweight approach to display a small collection of items, however, do not wish to use ListView or CollectionView considering the memory and performance issues, then you are at the right place. You are looking for a Bindable Layout.
Bindable layouts enable any layout class to generate its content by binding to a collection of items. It provides an option to set and customize the appearance of each item with a DataTemplate. Bindable layouts are provided by the BindableLayout class, which exposes the following attached properties,
- ItemsSource – specifies the list of items to be displayed.
- ItemTemplate – specifies the DataTemplate to apply to each item in the collection of items displayed.
- ItemTemplateSelector – specifies the DataTemplateSelector that will be used to choose a DataTemplate for an item at runtime.
In simple terms, a bindable layout is a small version of ListView to display a series of items with the same pattern. However, the only difference is that the Bindable Layout does not allow your items to scroll, unlike ListView.
Prerequisites
- Visual Studio 2017 or later (Windows or Mac)
Setting up a Xamarin.Forms Project
Let’s start by creating a new Xamarin.Forms project by following the below steps.
Visual Studio 2019 has more options in the launch view.
-
Clone or check out the code from any repository
-
Open a project or solution
-
Open a local folder from your computer
-
Create a new project
Choose "Create a new project".

Now, filter by Project Type as Mobile and choose the Mobile App (Xamarin.Forms).

Enter the project name of your wish. Usually, the project and solution name are the same for an app. Choose your preferred location for the project and click "Create".

Select the Blank App and target platforms - Android, iOS and Windows (UWP).

Wait for the solution to load. Expand the solution using the Solution Explorer. By default, you can see 4 projects (.NET Standard, Android, iOS and UWP).
Expand the .NET Standard project and select the XAML page and double-click to open the MainPage.xaml page. You now have a basic Xamarin.Forms app. Press F5 or click the run button to try it out.
Create a Bindable Layout
In this article, we will see how to create and use a Bindable Layout to display the list of platforms supported by Xamarin. For that first lets us create the model and view model classes required for binding to the view.
Create a new class called PlatformInfo.cs and declare the below properties.
- public class PlatformInfo : INotifyPropertyChanged
- {
- private bool _isChecked;
- private string _platformName;
- public bool IsChecked
- {
- get { return _isChecked; }
- set { _isChecked = value; NotifyPropertyChanged(); }
- }
- public string PlatformName
- {
- get { return _platformName; }
- set { _platformName = value; NotifyPropertyChanged(); }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- public void NotifyPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
- {
- if (this.PropertyChanged != null)
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }




sayyad hasanPosted May 27, 2020, 10:23 AM
It's late but Thanks, this article help me a lot to achieve my goal
Vidyadharran GPosted Nov 28, 2019, 12:01 AM
Nice article bro
Logesh PalaniPosted Nov 27, 2019, 10:44 AM
Nice One :)
Mageshwaran RPosted Nov 27, 2019, 8:46 AM
Nice Article...