Skip to content

Instantly share code, notes, and snippets.

@ads90
ads90 / BoxRenderer_Android.cs
Created February 13, 2018 02:05
Xamarin BoxRenderer
[assembly: ExportRenderer(typeof(Sample.CustomBoxView), typeof(SABoxViewRenderer))]
namespace Sample.Droid.UIRenderers
{
public class SABoxViewRenderer : BoxRenderer
{
public SABoxViewRenderer(Android.Content.Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
@ads90
ads90 / UIDirectionExtension
Last active March 18, 2018 11:36
RTL Support for Xamarin Forms
/*
how to use it
you have to design your xaml to fit your need
EX:
<ColumnDefinition Width="{UIExtensions:UIDirection Type=GridLength,LTR=auto ,RTL=*}" />
HorizontalTextAlignment="{UIExtensions:UIDirection Type=TextAlignment,LTR=Start,RTL=End}"
HorizontalOptions="{UIExtensions:UIDirection Type=LayoutOption, LTR=Start, RTL=End}"
*/
using System;
/*
this class will help you to have bindable children with different sizes for the stacklayout with scrollview
in you xaml add
<UIControls:SAStackLayout ItemsSource="{Binding YourDataSource}" Orientation="Horizontal">
<DataTemplate>
<Grid>
<Label Text="{Binding Name}" Margin="15,0" HorizontalOptions="Center" VerticalOptions="Center" FontSize="Small" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="White"/>
</Grid>
</DataTemplate>
</UIControls:SAStackLayout>