Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
namespace MyNamespace.Mobile.Controls
{
/// <summary>
/// Class GridView.
/// </summary>
xmlns:controls="clr-namespace:MyNamespace.Mobile.Controls"
<!--FolderGrid-->
<Grid x:Name="rootGrid" BackgroundColor="White" Grid.Row="1" Grid.Column="0">
<controls:GridView HorizontalOptions="FillAndExpand"
x:Name="GrdView" ItemsSource="{Binding FoldersInUserPocket}"
ItemHeight="400"
ItemWidth="330"
RowSpacing="30">
<controls:GridView.ItemTemplate>
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using Android.Content;
using Android.Content.Res;
using Android.Graphics;
using Android.Views;
using Android.Widget;
<ContentPage.Content>
<Grid x:Name="_rootGrid">
//SearchBar
<SearchBar IsVisible="{Binding SearchMode}" Placeholder="Search items.." Text="{Binding SearchText}">
<SearchBar.Behaviors>
<behaviors:EventToCommandBehavior EventName="TextChanged" Command="{Binding SearchCommand}"/>
</SearchBar.Behaviors>
</SearchBar>
#region Fields
private ObservableCollection<object> _Items;
private ObservableCollection<object> _ItemsFiltered;
private ObservableCollection<object> _ItemsUnfiltered;
private string _searchText;
#endregion
#region Properties
public string SearchText
using System;
using Xamarin.Forms;
namespace MyNameSpace
{
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
{
public T AssociatedObject { get; private set; }
protected override void OnAttachedTo(T bindable)
using System;
using System.Reflection;
using System.Windows.Input;
using Xamarin.Forms;
namespace MyNameSpace
{
public class EventToCommandBehavior : BehaviorBase<View>
{
Delegate eventHandler;
public class DataFactory
{
public List<User> Users = new List<User>()
{
new User{ Id = 1, Name = "Abigail Roberts", Designation = "Sr.Manager", PhoneNumber = "+917000800000", ProfilePicture = "user1.png"},
new User{ Id = 2, Name = "Lance Johnston", Designation = "Jr.Manager", PhoneNumber = "+913467347734", ProfilePicture = "user2.png"},
new User{ Id = 3, Name = "Melinda Walters ", Designation = "Analyst", PhoneNumber = "+1221211211", ProfilePicture = "user3.png"},
new User{ Id = 4, Name = "Xuan Li Chow", Designation = "Trainee", PhoneNumber = "+121256578939", ProfilePicture = "user4.png"},
new User{ Id = 5, Name = "James Lamb", Designation = "Intern", PhoneNumber = "+67122210133", ProfilePicture = "user5.png"},
new User{ Id = 6, Name = "Nikki A. Rubin", Designation = "Intern", PhoneNumber = "+6713420133", ProfilePicture = "user6.png"},
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MultiTapLVItems"
x:Class="MultiTapLVItems.MainPage">
<ContentPage.Resources>
<ResourceDictionary>
<DataTemplate x:Key="MyCardTemplate">
<ViewCell>
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using static MultiTapLVItems.DataFactory;
namespace MultiTapLVItems
{
public partial class MainPage : ContentPage
{
public MainPage()