public ButtonNumberPad (int number)
		{
			_colorBackgroundButtonOnClick = Color.FromRgb (243, 243, 243);
			_colorBackgroundButton = Color.White;
			_colorTextOnClick = Color.FromRgb (153, 153, 153);
			_colorText = Color.Black;
		
			BackgroundColor = _colorBackgroundButton;

			_number = number;

			_labelToShow = new LabelRegularFont {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center,
				TextColor = _colorText
			};

			if (number == 11) { //Show backspace image
				_imageToShow = new Image {
					Source = "Backspace.png",
					Scale = 0.5,
					HeightRequest = 40,
					WidthRequest = 40
				};

				Children.Add (_imageToShow,
					Constraint.Constant (0),
					Constraint.Constant (0),
					Constraint.RelativeToParent ((parent) => parent.Width),
					Constraint.RelativeToParent ((parent) => parent.Height));
			}
			else { //Show number label
				if (number != 10) { //10 = empty label
					_labelToShow.Text = number.ToString ();
				}
				Children.Add (_labelToShow,
					Constraint.Constant (0),
					Constraint.Constant (0),
					Constraint.RelativeToParent ((parent) => parent.Width),
					Constraint.RelativeToParent ((parent) => parent.Height));
			}

			Button button = new Button { BackgroundColor = Color.Transparent, ClassId = number.ToString () };
			button.Clicked += OnButtonClicked;
				
			Children.Add (button,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((parent) => parent.Width),
				Constraint.RelativeToParent ((parent) => parent.Height));

			VerticalOptions = LayoutOptions.FillAndExpand;
			HorizontalOptions = LayoutOptions.FillAndExpand;

			ChangeAppearenceBasedOnDeviceType ();
		}
예제 #2
0
		public PinTile ()
		{
			SetColorTheme(AppConfigConstants.AppTheme);

			_labelPin = new LabelRegularFont {
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				TextColor = _colorText,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center
			};

			ChangeAppearenceBasedOnDeviceType ();

			VerticalOptions = LayoutOptions.Fill;
			HorizontalOptions = LayoutOptions.FillAndExpand;

			Children.Add (_labelPin);
		}