Ejemplo n.º 1
0
        public AppDateSelectorEditor() : base()
        {
            _editor = new AppEntry
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End
            };
            _editor.SetBinding(AppEntry.TextColorProperty, new Binding(TextColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _editor.SetBinding(AppEntry.AppFontProperty, new Binding(AppFontProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _editor.SetBinding(AppEntry.FontSizeProperty, new Binding(FontSizeProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _editor.SetBinding(AppEntry.HorizontalTextAlignmentProperty, new Binding(HorizontalTextAlignmentProperty.PropertyName, BindingMode.OneWay, null, null, null, this));

            var line = new ContentView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };

            line.SetBinding(ContentView.BackgroundColorProperty, new Binding(LineColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));

            var touchContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
            };

            var touchGesture = new TapGestureRecognizer();

            touchGesture.Tapped += (sender, args) => {
                this.SetFocus();
            };
            this.GestureRecognizers.Add(touchGesture);

            touchContent.GestureRecognizers.Add(touchGesture);

            var grid = new Grid
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                RowSpacing        = 10,
                ColumnSpacing     = 0,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Absolute)
                    }
                }
            };

            grid.Children.Add(_editor, 0, 0);
            grid.Children.Add(touchContent, 0, 0);
            grid.Children.Add(line, 0, 1);

            this.Content = grid;
        }
Ejemplo n.º 2
0
        public AppEntryEditor() : base()
        {
            _entry = new AppEntry
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End
            };

            yourMethod(_entry);
        }
Ejemplo n.º 3
0
        public AppSearchEntryEditor()
        {
            _entry = new AppEntry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            yourMethod(_entry);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  Capitalize the first character of every word.
        /// </summary>
        public AppEntryEditor(bool capitalized) : base()
        {
            if (capitalized)
            {
                _entry = new AppEntryCapitalization
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.End
                };
            }
            else
            {
                _entry = new AppEntry
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.End
                };
            }

            yourMethod(_entry);
        }
Ejemplo n.º 5
0
        private void yourMethod(AppEntry _entry)
        {
            _image = new Image
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
            };
            _image.SetBinding(Image.HeightRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));
            _image.SetBinding(Image.WidthRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));

            _imageContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Fill,
                Content           = _image
            };

            //Cakesoft Fixed SB-5
            //Removed repeate initialization of _entry, which is done in contructor.
            _entry.SetBinding(AppEntry.TextProperty, new Binding(TextProperty.PropertyName, BindingMode.TwoWay, null, null, null, this));
            _entry.SetBinding(AppEntry.TextColorProperty, new Binding(TextColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.KeyboardProperty, new Binding(KeyboardProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.IsPasswordProperty, new Binding(IsPasswordProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.PlaceholderProperty, new Binding(PlaceholderProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.PlaceholderColorProperty, new Binding(PlaceholderColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.AppFontProperty, new Binding(AppFontProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.FontSizeProperty, new Binding(FontSizeProperty.PropertyName, BindingMode.OneWay, null, null, null, this));

            _entry.Completed += (sender, args) => {
                this.DoCompleted();
            };
            _entry.Focused += (sender, args) => {
                this.DoFocused();
            };

            _entry.TextChanged += (sender, args) =>
            {
                this.DoTextChanged(sender, args);
            };

            var entryContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Padding           = new Thickness(0, 0, 0, 10),
                Content           = _entry
            };

            var line = new ContentView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };

            line.SetBinding(ContentView.BackgroundColorProperty, new Binding(LineColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));

            var grid = new Grid
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                RowSpacing        = 0,
                ColumnSpacing     = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Absolute)
                    }
                }
            };

            grid.Children.Add(_imageContent, 0, 0);
            grid.Children.Add(entryContent, 1, 0);
            grid.Children.Add(line, 0, 2, 1, 2);

            var touchGesture = new TapGestureRecognizer();

            touchGesture.Tapped += (sender, args) => {
                _entry.Focus();
            };
            this.GestureRecognizers.Add(touchGesture);

            this.SetColor();
            this.SetImageOffset();
            this.SetImageVisible();

            this.Content = grid;
        }
Ejemplo n.º 6
0
        private void yourMethod(AppEntry _entry)
        {
            _leftImage = new AppImageCommand
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Aspect            = Aspect.Fill,
                Source            = "left_gray",
            };
            _leftImage.SetBinding(Image.HeightRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));
            _leftImage.SetBinding(Image.WidthRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));
            _leftImage.SetBinding(AppImageCommand.CommandProperty, "LeftEntryCommand");



            _leftImageContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,

                Content = _leftImage
            };

            //Cakesoft Fixed SB-5
            //Removed repeate initialization of _entry, which is done in contructor.
            _entry.SetBinding(AppEntry.TextProperty, new Binding(TextProperty.PropertyName, BindingMode.TwoWay, null, null, null, this));
            _entry.SetBinding(AppEntry.TextColorProperty, new Binding(TextColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.KeyboardProperty, new Binding(KeyboardProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.IsPasswordProperty, new Binding(IsPasswordProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.PlaceholderProperty, new Binding(PlaceholderProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.PlaceholderColorProperty, new Binding(PlaceholderColorProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.AppFontProperty, new Binding(AppFontProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.FontSizeProperty, new Binding(FontSizeProperty.PropertyName, BindingMode.OneWay, null, null, null, this));
            _entry.SetBinding(AppEntry.WidthRequestProperty, new Binding(WidthRequestProperty.PropertyName, BindingMode.OneWay, null, null, null, this));

            _entry.Completed += (sender, args) => {
                this.DoCompleted();
            };
            _entry.Focused += (sender, args) => {
                this.DoFocused();
            };

            _entry.TextChanged += (sender, args) =>
            {
                this.DoTextChanged(sender, args);
            };

            var entryContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Padding           = new Thickness(0, 0, 0, 5),
                Content           = _entry
            };

            var _rightImage = new AppImageCommand
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Aspect            = Aspect.Fill,


                Source = "plus_gray",
            };

            _rightImage.SetBinding(Image.HeightRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));
            _rightImage.SetBinding(Image.WidthRequestProperty, new Binding("ImageSize", BindingMode.OneWay, null, null, null, this));
            _rightImage.SetBinding(AppImageCommand.CommandProperty, "RightEntryCommand");

            _rightImageContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Padding           = new Thickness(0, 0, 5, 0),
                Content           = _rightImage
            };
            var grid = new Grid
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                RowSpacing        = 0,
                ColumnSpacing     = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                }
            };

            grid.Children.Add(_leftImageContent, 0, 0);
            grid.Children.Add(entryContent, 1, 0);
            grid.Children.Add(_rightImageContent, 2, 0);

            var touchGesture = new TapGestureRecognizer();

            touchGesture.Tapped += (sender, args) => {
                _entry.Focus();
            };
            this.GestureRecognizers.Add(touchGesture);

            this.SetColor();


            this.Content = grid;
        }