Skip to content

Instantly share code, notes, and snippets.

@jedusei
jedusei / CollectionViewAdapter.cs
Created September 30, 2022 12:54
MAUI CollectionView Android Scroll Lag Workaround
// Platforms/Android/CollectionViewAdapter.cs
using Android.Content;
using AndroidX.RecyclerView.Widget;
using Microsoft.Maui.Controls.Handlers.Items;
public class CollectionViewAdapter : ReorderableItemsViewAdapter<ReorderableItemsView, IGroupableItemsViewSource>
{
private readonly List<DataTemplate> _dataTemplates = new();
private const int _textItemViewType = 41; // Microsoft.Maui.Controls.Handlers.Items.ItemViewType.TextItem
private const int _templatedItemViewType = 42; // Microsoft.Maui.Controls.Handlers.Items.ItemViewType.TemplatedItem
@jedusei
jedusei / SizeLimitView.cs
Created May 16, 2022 20:30
Set a minimum/maximum size for a view in Xamarin Forms
using System;
using Xamarin.Forms;
namespace App.Controls
{
public class SizeLimitView : ContentView
{
public static readonly BindableProperty MaximumWidthRequestProperty = BindableProperty.Create(nameof(MaximumWidthRequest), typeof(double), typeof(SizeLimitView), -1.0);
public static readonly BindableProperty MaximumHeightRequestProperty = BindableProperty.Create(nameof(MaximumHeightRequest), typeof(double), typeof(SizeLimitView), -1.0);