Example #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

#if __ANDROID__
            if (Control != null)
            {
                Control.SetBackgroundColor(Android.Graphics.Color.Transparent);
                Control.SetPadding(5, 0, 0, 0);
                Control.Gravity = Android.Views.GravityFlags.CenterVertical;
            }
#elif __IOS__
            if (e.NewElement != null)
            {
                View = (BaseEntry)e.NewElement;

                if (View.AutoCorrectEnabled)
                {
                    EnableAutoCorrect();
                }
                else
                {
                    DisableAutoCorrect();
                }
            }
#endif
        }
Example #2
0
        public NavigationBar()
        {
            Console.WriteLine(Device.RuntimePlatform);

            BackgroundColor = Colors.CartoNavyLight;

            statusbar = new BaseView {
                BackgroundColor = Colors.CartoNavyLight
            };
            container = new BaseView();

            Title                         = new MeasuredLabel();
            Title.TextColor               = Color.White;
            Title.FontAttributes          = FontAttributes.Bold;
            Title.VerticalTextAlignment   = TextAlignment.Center;
            Title.HorizontalTextAlignment = TextAlignment.Center;
            Title.FontSize                = 14;
            Title.NumberOfLines           = 1;

            field = new BaseEntry();
            field.BackgroundColor    = Colors.CartoNavyLight;
            field.TextColor          = Title.TextColor;
            field.FontSize           = Title.FontSize;
            field.AutoCorrectEnabled = false;
            field.FontAttributes     = Title.FontAttributes;
            field.IsVisible          = false;

            Back = new NavigationBackButton();

            Edit = new TitleEditButton();

            Title.Measured += delegate
            {
                double x = Width / 2 - Title.MeasuredWidth / 2;

                Title.UpdateLayout(x, BaseY, Title.MeasuredWidth, Height - BaseY);
                Edit.UpdateX(x + Title.MeasuredWidth);
            };
        }