using Xamarin.Forms; namespace Gallery.Resources.UI { public static class Extensions { public const string TextColor = nameof(TextColor); public const string SubTextColor = nameof(SubTextColor); public const string OptionTintColor = nameof(OptionTintColor); public static T Binding(this T view, BindableProperty property, string name, BindingMode mode = BindingMode.Default, IValueConverter converter = null) where T : BindableObject { if (name == null) { view.SetValue(property, property.DefaultValue); } else { view.SetBinding(property, name, mode, converter); } return view; } public static T DynamicResource(this T view, BindableProperty property, string key) where T : Element { view.SetDynamicResource(property, key); return view; } public static T GridRow(this T view, int row) where T : BindableObject { Grid.SetRow(view, row); return view; } public static T GridRowSpan(this T view, int rowSpan) where T : BindableObject { Grid.SetRowSpan(view, rowSpan); return view; } public static T GridColumn(this T view, int column) where T : BindableObject { Grid.SetColumn(view, column); return view; } public static T GridColumnSpan(this T view, int columnSpan) where T : BindableObject { Grid.SetColumnSpan(view, columnSpan); return view; } } }