コード例 #1
0
        public void prepareControlView()
        {
            controlView = new ControlView(new CGRect(0, View.Bounds.Height - 56, View.Bounds.Width, 56));
            View.Layout(controlView).Bottom(0).Left(0).Right(0);

            var undoButton = new FlatButton();

            undoButton.PulseColor = MaterialColor.White;
            undoButton.SetTitle("UNDO", UIControlState.Normal);
            undoButton.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var undoButton2 = new FlatButton();

            undoButton2.PulseColor = MaterialColor.White;
            undoButton2.SetTitle("UNDO", UIControlState.Normal);
            undoButton2.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var label = new UILabel();

            label.Text      = "Archived";
            label.TextColor = MaterialColor.White;

            controlView.BackgroundColor = MaterialColor.Grey.Darken4;
            controlView.ContentView.AddSubview(label);
            controlView.RightControls = new UIControl[] {
                undoButton, undoButton2
            };
            controlView.ContentInsetPreset = MaterialEdgeInset.WideRectangle3;

            //View.AddSubview(controlView);
            controlView.ContentView.Grid().Views = new List <UIView>()
            {
                label
            };
        }
コード例 #2
0
        private UIButton GetPositiveButton(string title, Action action)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            var imageColor = UIColor.White.ColorWithAlpha(0.35f);

            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Normal);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Selected);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Highlighted);

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                ClickedEvent();
            };

            return(button);
        }
コード例 #3
0
        private UIButton GetNormalButton(string title, Action action, bool isCancellation = false)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = _dialogView.BackgroundColor,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                if (isCancellation)
                {
                    DismissEvent();
                }
                else
                {
                    ClickedEvent();
                }
            };

            return(button);
        }
コード例 #4
0
            public override void ApplyTo(FlatButton button)
            {
                base.ApplyTo(button);

                if (button == null)
                {
                    return;
                }

                button.SetFillColor(GetColor(x => x.ColorBackgroundNormal, Theme.CompanyColor), UIControlState.Normal);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, Theme.CompanyColor), UIControlState.Selected);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, Theme.CompanyColor), UIControlState.Highlighted);

                button.SetTitleColor(GetColor(x => x.ColorTextNormal, Theme.LabelTextColor), UIControlState.Normal);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, Theme.LabelTextColor.ColorWithAlpha(0.5f)), UIControlState.Selected);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, Theme.LabelTextColor.ColorWithAlpha(0.5f)), UIControlState.Highlighted);

                button.SetStrokeColor(GetColor(x => x.ColorBorder, Theme.LabelTextColor));
            }
コード例 #5
0
            public override void ApplyTo(FlatButton button)
            {
                base.ApplyTo(button);

                if (button == null)
                {
                    return;
                }

                button.SetFillColor(GetColor(x => x.ColorBackgroundNormal, UIColor.Clear), UIControlState.Normal);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, UIColor.Blue), UIControlState.Selected);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, UIColor.Blue), UIControlState.Highlighted);

                button.SetTitleColor(GetColor(x => x.ColorTextNormal, UIColor.Blue), UIControlState.Normal);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, UIColor.White), UIControlState.Selected);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, UIColor.White), UIControlState.Highlighted);

                button.SetStrokeColor(GetColor(x => x.ColorBorder, UIColor.Blue));
            }
コード例 #6
0
        public void prepareFlatButtonExample()
        {
            nfloat w      = 200;
            var    button = new FlatButton(new CGRect((View.Bounds.Width - w) / 2, 100, w, 48));

            button.SetTitle("Button Raised", UIControlState.Normal);
            button.SetTitleColor(MaterialColor.Blue.Base, UIControlState.Normal);
            button.PulseColor      = MaterialColor.Blue.Base;
            button.TitleLabel.Font = MaterialFont.SystemFontWithSize(24f);
            View.AddSubview(button);
        }
コード例 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            // Setup buttons
            var Button1 = new FlatButton()
            {
                Depth     = 3f,
                FaceColor = ColorConstant.BUTTON1FACE,
                Frame     = new RectangleF(60, 80, 200, 60),
                Margin    = 4f,
                Radius    = 8f,
                SideColor = ColorConstant.BUTTON1SIDE
            };

            Button1.SetTitle("Button", UIControlState.Normal);
            Button1.SetTitleColor(UIColor.White, UIControlState.Normal);

            var Button2 = new FlatButton()
            {
                Depth     = 6f,
                FaceColor = ColorConstant.BUTTON2FACE,
                Frame     = new RectangleF(60, 180, 200, 60),
                Margin    = 7f,
                Radius    = 6f,
                SideColor = ColorConstant.BUTTON2SIDE
            };

            Button2.SetTitle("Button", UIControlState.Normal);
            Button2.SetTitleColor(UIColor.White, UIControlState.Normal);

            var Button3 = new FlatButton()
            {
                Enabled   = false,
                Depth     = 3f,
                FaceColor = ColorConstant.BUTTON3FACE,
                Frame     = new RectangleF(60, 280, 200, 60),
                Margin    = 4f,
                Radius    = 8f,
                SideColor = ColorConstant.BUTTON3SIDE
            };

            Button3.SetTitle("Disabled", UIControlState.Normal);
            Button3.SetTitleColor(UIColor.White, UIControlState.Normal);

            View.Add(Button1);
            View.Add(Button2);
            View.Add(Button3);
        }
コード例 #8
0
		void prepareCardView()
		{
			var cardView = new Card();
			cardView.BackgroundColor = Color.Grey.Lighten5;
			cardView.SetCornerRadiusPreset(CornerRadiusPreset.Radius1);
			cardView.Divider = false;
			cardView.ContentViewEdgeInsets = EdgeInsetsPreset.None;
			cardView.SetLayoutEdgeInsetsPreset(EdgeInsetsPreset.Square2;
			cardView.righ = EdgeInsetsPreset.Square2;
			cardView.ContentViewInsetPreset = EdgeInsetsPreset.None;

			var titleLabel = new UILabel();
			titleLabel.Font = RobotoFont.MediumWithSize(20);
			titleLabel.Text = "Messages";
			titleLabel.TextAlignment = UITextAlignment.Center;
			titleLabel.TextColor = MaterialColor.BlueGrey.Darken4;

			var v = new UIView();
			v.BackgroundColor = MaterialColor.Blue.Accent1;

			var closeButton = new FlatButton();
			closeButton.SetTitle("Close", UIControlState.Normal);
			closeButton.SetTitleColor(MaterialColor.Blue.Accent3, UIControlState.Normal);

			var image = MaterialIcon.CM.Settings;
			var settingButton = new IconButton();
			settingButton.TintColor = MaterialColor.Blue.Accent3;
			settingButton.SetImage(image, UIControlState.Normal);
			settingButton.SetImage(image, UIControlState.Highlighted);

			cardView.TitleLabel = titleLabel;
			cardView.ContentView = tableView;
			cardView.LeftButtons = new UIButton[] { closeButton};
			cardView.RightButtons = new UIButton[] { settingButton };

			View.Layout(cardView).Edges(left: 10f, right: 10f, top: 100f, bottom: 100f);
		}