balance binding

This commit is contained in:
2022-02-26 17:29:12 +08:00
parent 4d69bea70b
commit 283acf7d35
6 changed files with 59 additions and 32 deletions

View File

@ -19,7 +19,7 @@ namespace Billing.UI
return obj;
}
public static View HorizontalOptions(this View view, LayoutOptions options)
public static T HorizontalOptions<T>(this T view, LayoutOptions options) where T : View
{
if (view != null)
{
@ -28,7 +28,7 @@ namespace Billing.UI
return view;
}
public static View VerticalOptions(this View view, LayoutOptions options)
public static T VerticalOptions<T>(this T view, LayoutOptions options) where T : View
{
if (view != null)
{
@ -37,41 +37,41 @@ namespace Billing.UI
return view;
}
public static View DynamicResource(this View view, BindableProperty property, string key)
public static T Margin<T>(this T view, Thickness margin) where T : View
{
view.Margin = margin;
return view;
}
public static T DynamicResource<T>(this T view, BindableProperty property, string key) where T : Element
{
view.SetDynamicResource(property, key);
return view;
}
public static View GridColumn(this View view, int column)
public static T GridColumn<T>(this T view, int column) where T : BindableObject
{
Grid.SetColumn(view, column);
return view;
}
public static View GridRow(this View view, int row)
public static T GridRow<T>(this T view, int row) where T : BindableObject
{
Grid.SetRow(view, row);
return view;
}
public static View GridColumnSpan(this View view, int columnSpan)
public static T GridColumnSpan<T>(this T view, int columnSpan) where T : BindableObject
{
Grid.SetColumnSpan(view, columnSpan);
return view;
}
public static View GridRowSpan(this View view, int rowSpan)
public static T GridRowSpan<T>(this T view, int rowSpan) where T : BindableObject
{
Grid.SetRowSpan(view, rowSpan);
return view;
}
public static View Margin(this View view, Thickness margin)
{
view.Margin = margin;
return view;
}
}
public class Tap : IDisposable