Skip to content

Instantly share code, notes, and snippets.

View rotorgames's full-sized avatar

Kirill rotorgames

View GitHub Profile
@rotorgames
rotorgames / CustomCollectionViewRenderer.cs
Last active June 23, 2022 17:39
CollectionView GridViewLayout one element alignment issue
public class CustomCollectionViewRenderer : GroupableItemsViewRenderer<CustomCollectionView, GroupableItemsViewController<CustomCollectionView>>
{
ItemsViewLayout _layout;
protected override ItemsViewLayout SelectLayout()
{
var itemSizingStrategy = ItemsView.ItemSizingStrategy;
var itemsLayout = ItemsView.ItemsLayout;
if (itemsLayout is GridItemsLayout gridLayout)
@rotorgames
rotorgames / SmartObservableCollection.cs
Created December 16, 2020 18:38
Smart ObservableCollection
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
namespace Example
{
public class SmartObservableCollection<T> : ObservableCollection<T>
{
@rotorgames
rotorgames / AdjustedContainer.cs
Last active April 26, 2020 15:22
Xamarin.Forms AdjustedContainer
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
using Xamarin.Forms;
namespace App.Controls
{
public class AdjustedContainer : ContentView
{
public static readonly BindableProperty MinWidthProperty = BindableProperty.Create(nameof(MinWidth), typeof(AdjustedSize), typeof(AdjustedContainer), AdjustedSize.Auto);
public TestView : View
{
private static void OnItemSourceChanged(BindableObject bindable, object oldvalue, object newvalue)
{
var self = (TestView) bindable;
var oldCollection = oldvalue as INotifyCollectionChanged;
var newCollection = newvalue as INotifyCollectionChanged;
if (oldCollection != null)
oldCollection.CollectionChanged -= self.OnItemSourceCollectionChanged;
@rotorgames
rotorgames / AndroidRenderer.cs
Created October 9, 2019 18:21
Carousel Gestures
public override bool OnTouchEvent(MotionEvent e)
{
switch(e.Action)
{
case MotionEventActions.Down:
case MotionEventActions.PointerDown:
case MotionEventActions.Pointer2Down:
if(Element?.Content != null && IsHorizontalScrollStarted())
Parent?.RequestDisallowInterceptTouchEvent(true);
break;
@rotorgames
rotorgames / BarcodePickerView.cs
Created March 27, 2019 05:28
BarcodePickerView Xamarin.Forms
using System.Windows.Input;
using Xamarin.Forms;
using System;
using System.ComponentModel;
using Scandit.BarcodePicker.Unified.Abstractions;
namespace ProjectName.Controls.BarcodeScanner
{
public class BarcodePickerView : View
{
@rotorgames
rotorgames / renderer.cs
Last active September 6, 2018 10:37
orientation
using System;
using System.ComponentModel;
using CoreFoundation;
using Foundation;
using Rg.Forms.Enumerables.Device;
using Rg.Forms.Events.Device;
using Rg.Forms.Extensions.Device;
using Rg.Forms.iOS.Extensions.Device;
using Rg.Forms.iOS.Renderers.Pages;
using Rg.Forms.Interfaces.Contracts.Services.Device;
using Lottie.Forms;
using Xamarin.Forms;
namespace Shping.Controls.Lottie
{
public class LottieAnimationView : AnimationView
{
public static readonly BindableProperty AssetFolderProperty = BindableProperty.Create(nameof(AssetFolder), typeof(string), typeof(LottieAnimationView));
public string AssetFolder
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FreshWind.iOS.Renderers.NavigationPages;
using FreshWind.Views.NavigationPages;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
@rotorgames
rotorgames / WbContentPageRenderer.cs
Created February 13, 2017 15:45
Left icon, title align, droid
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Graphics;