Пример #1
0
        public LargeNumberEntry2(Color backgroundColor)
        {
            //this.HasShadow = false;
            this.Padding = new Thickness(0);

            entry = new BybLargeEntry()
            {
                KeepOnlyNumbers = true,
                //WidthRequest = 100,
                Keyboard          = Keyboard.Numeric,
                BackgroundColor   = backgroundColor,
                VerticalOptions   = Config.App == MobileAppEnum.SnookerForVenues ? LayoutOptions.FillAndExpand :LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Fill,//LayoutOptions.Center,
                //HorizontalTextAlignment = TextAlignment.Center,
                Placeholder = "--",
                Text        = null,
            };
            entry.TextChanged += (s1, e1) =>
            {
                if (this.ignoreUIEvents)
                {
                    return;
                }
                if (this.NumberChanged != null)
                {
                    this.NumberChanged(this, EventArgs.Empty);
                }
            };
            entry.Focused += (s1, e1) =>
            {
                if (this.FocusedOnNumber != null)
                {
                    this.FocusedOnNumber(this, EventArgs.Empty);
                }
            };
            entry.Unfocused += (s1, e1) =>
            {
                if (this.UnfocusedFromNumber != null)
                {
                    this.UnfocusedFromNumber(this, EventArgs.Empty);
                }
            };
            this.Children.Add(entry);
            //this.Content = entry;
        }
Пример #2
0
        public LargeNumberEntry(string title, Color backgroundColor)
        {
            entry = new BybLargeEntry()
            {
                KeepOnlyNumbers   = true,
                WidthRequest      = 100,
                Keyboard          = Keyboard.Numeric,
                BackgroundColor   = backgroundColor,              //Config.ColorDarkGrayBackground,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,

                //#if __ANDROID__
                HorizontalTextAlignment = TextAlignment.Center,
                Placeholder             = "--",
                Text = null,
                //#endif
            };
            entry.TextChanged += (s1, e1) =>
            {
                if (this.ignoreUIEvents)
                {
                    return;
                }
                if (this.NumberChanged != null)
                {
                    this.NumberChanged(this, EventArgs.Empty);
                }
            };
            entry.Focused += (s1, e1) =>
            {
                if (this.FocusedOnNumber != null)
                {
                    this.FocusedOnNumber(this, EventArgs.Empty);
                }
            };
            entry.Unfocused += (s1, e1) =>
            {
                if (this.UnfocusedFromNumber != null)
                {
                    this.UnfocusedFromNumber(this, EventArgs.Empty);
                }
            };

            this.label = new BybLabel
            {
                Text      = title,
                TextColor = Config.ColorTextOnBackground,
                //WidthRequest = Config.IsTablet ? 120 : 60,
                HorizontalOptions       = LayoutOptions.Fill,//LayoutOptions.Start,
                HorizontalTextAlignment = TextAlignment.Start,
            };

            this.Orientation     = StackOrientation.Vertical;
            this.BackgroundColor = backgroundColor;            //Config.ColorDarkGrayBackground;
            this.Spacing         = 3;
            this.Children.Add(label);
            this.Children.Add(entry);
            this.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    this.entry.Focus();
                }),
                NumberOfTapsRequired = 1
            });
        }