123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Input;
- using Syncfusion.DocIO.DLS;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.Resources.Typography;
- namespace comal.timesheets
- {
-
- public class ActionButtonClickEventArgs : EventArgs
- {
- public object Tag { get; private set; }
- public ActionButtonClickEventArgs(object tag)
- {
- Tag = tag;
- }
- }
-
- public delegate void ActionButtonClickEvent(object sender, ActionButtonClickEventArgs args);
-
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class ActionButton
- {
- public event ActionButtonClickEvent Clicked;
-
- public static readonly BindableProperty TagProperty = BindableProperty.Create(
- nameof(Tag),
- typeof(object),
- typeof(ActionButton));
-
- public object Tag
- {
- get => GetValue(TagProperty);
- set => SetValue(TagProperty, value);
- }
-
- public static readonly BindableProperty OrientationProperty = BindableProperty.Create(
- nameof(Orientation),
- typeof(StackOrientation),
- typeof(ActionButton),
- StackOrientation.Horizontal);
-
- public StackOrientation Orientation
- {
- get => (StackOrientation)GetValue(OrientationProperty);
- set => SetValue(OrientationProperty, value);
- }
-
- public static readonly BindableProperty ImageProperty = BindableProperty.Create(
- nameof(Image),
- typeof(ImageSource),
- typeof(ActionButton)
- );
-
- public ImageSource Image
- {
- get => GetValue(ImageProperty) as ImageSource;
- set => SetValue(ImageProperty, value);
- }
-
- public static readonly BindableProperty TextProperty = BindableProperty.Create(
- nameof(Text),
- typeof(String),
- typeof(ActionButton)
- );
-
- public String Text
- {
- get => (String)GetValue(TextProperty);
- set => SetValue(TextProperty, value);
- }
-
- public static readonly BindableProperty AlertProperty = BindableProperty.Create(
- nameof(Alert),
- typeof(String),
- typeof(ActionButton)
- );
-
- public String Alert
- {
- get => (String)GetValue(AlertProperty);
- set => SetValue(AlertProperty, value);
- }
-
- public static readonly BindableProperty TextColorProperty = BindableProperty.Create(
- nameof(TextColor),
- typeof(Color),
- typeof(ActionButton),
- XF.Material.Forms.Material.Color.OnSecondary);
- public Color TextColor
- {
- get => (Color)GetValue(TextColorProperty);
- set => SetValue(TextColorProperty, value);
- }
-
- public static readonly BindableProperty TypeScaleProperty = BindableProperty.Create(
- nameof(TypeScale),
- typeof(MaterialTypeScale),
- typeof(ActionButton),
- MaterialTypeScale.Button);
-
- public MaterialTypeScale TypeScale
- {
- get => (MaterialTypeScale)GetValue(TypeScaleProperty);
- set => SetValue(TypeScaleProperty, value);
- }
-
- public new static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(
- nameof(BackgroundColor),
- typeof(Color),
- typeof(ActionButton),
- XF.Material.Forms.Material.Color.Secondary);
- public new Color BackgroundColor
- {
- get => (Color)GetValue(BackgroundColorProperty);
- set => SetValue(BackgroundColorProperty, value);
- }
- public static readonly BindableProperty BorderColorProperty = BindableProperty.Create(
- nameof(BorderColor),
- typeof(Color),
- typeof(ActionButton),
- XF.Material.Forms.Material.Color.SecondaryVariant);
- public Color BorderColor
- {
- get => (Color)GetValue(BorderColorProperty);
- set => SetValue(BorderColorProperty, value);
- }
-
- public static readonly BindableProperty PaddingProperty = BindableProperty.Create(
- nameof(Padding),
- typeof(Thickness),
- typeof(ActionButton),
- new Thickness(5));
- public new Thickness Padding
- {
- get => (Thickness)GetValue(PaddingProperty);
- set => SetValue(PaddingProperty, value);
- }
-
- public ActionButton()
- {
- InitializeComponent();
- Alert = "";
- }
-
- private void _frame_OnClicked(object sender, EventArgs e)
- {
- Clicked?.Invoke(this, new ActionButtonClickEventArgs(Tag));
- }
- }
- }
|