Example #1
0
        public FloatingEntry()
        {
            var containerStackLayout = new StackLayout {
                VerticalOptions = LayoutOptions.StartAndExpand, Spacing = 2, Padding = 5
            };

            _infoLabel = new Label
            {
                Opacity                 = 0,
                HorizontalOptions       = LayoutOptions.Start,
                HorizontalTextAlignment = TextAlignment.Start
            };
            _textEntry = new BorderlessEntry {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            containerStackLayout.Children.Add(_infoLabel);
            var entryFrame = new Frame {
                BackgroundColor = (Color)Application.Current.Resources["White75"], Padding = 0, CornerRadius = 3
            };
            var entryLayout = new StackLayout {
                Padding = 6
            };

            _imageAndEntryStackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                Spacing           = 0
            };
            _image = new TintableImage
            {
                HorizontalOptions = LayoutOptions.Start,
                IsVisible         = false
            };
            _imageAndEntryStackLayout.Children.Add(_image);
            _imageAndEntryStackLayout.Children.Add(_textEntry);
            _border = new BoxView
            {
                Margin            = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HeightRequest     = 1
            };
            entryLayout.Children.Add(_imageAndEntryStackLayout);
            //entryLayout.Children.Add(_border);
            entryFrame.Content = entryLayout;
            containerStackLayout.Children.Add(entryFrame);
            _tapGestureRecognizer         = new TapGestureRecognizer();
            _tapGestureRecognizer.Tapped += Tapped;
            containerStackLayout.GestureRecognizers.Add(_tapGestureRecognizer);
            Content                     = containerStackLayout;
            _entryWasEmpty              = true;
            _textEntry.TextChanged     += TextEntryOnTextChanged;
            _textEntry.PropertyChanged += TextEntryChanged;
            _textEntry.Focused         += TextEntryOnFocused;
            _textEntry.Unfocused       += TextEntryOnUnfocused;
        }