/// <summary>
		/// Updates the font.
		/// </summary>
        private void UpdateFont (ExtendedEntry element)
		{
            if (string.IsNullOrEmpty(element.FontFamily))
                return;
            
			(Control as UITextField).Font = UIFont.FromName (element.FontFamily, 
				(Control as UITextField).Font.PointSize);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="FloatingLabelDemo.FloatLabelControl"/> class.
		/// </summary>
		public FloatingLabelControl ()
		{
            HeightRequest = Device.OnPlatform<int>(50, 50, 75);
            InputTransparent = false;

			// Create placeholder label
			_floatingLabel = new Label {
				BackgroundColor = Color.Transparent,
				Text = Placeholder,
				FontAttributes = FontAttributes.Bold,
				XAlign = TextAlignment.Start,
				YAlign = TextAlignment.Center,
                FontSize = LabelFontSize,
				Opacity = 0.0,
                TextColor = PlaceholderColor,
                InputTransparent = true
			};

			// Create textfield
			_textEntry = new ExtendedEntry { 
				Keyboard = this.Keyboard,
                BackgroundColor = Color.Transparent,
				VerticalOptions = LayoutOptions.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
			};
				
			_textEntry.SetBinding (Entry.TextProperty, TextProperty.PropertyName, BindingMode.TwoWay);
			_textEntry.BindingContext = this;
            _textEntry.Focused += (object sender, FocusEventArgs e) =>
            {
                UpdatePlaceholderColor();
             
                if(Focused != null)
                    Focused(this, e);
            };
                
            _textEntry.Unfocused += (object sender, FocusEventArgs e) =>
            {
                UpdatePlaceholderColor();

                if(Unfocused != null)
                    Unfocused(this, e);
            };

			_textEntry.TextChanged += TextEntry_TextChanged;

            // Postfix
            _postFix = new Label{
				BackgroundColor = Color.Transparent,                
				XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,                
				TextColor = PostfixColor,
                InputTransparent = true
            };

		    UpdatePostFix();

			// create stacklayout for entry and postfix
            _entryAndPostfixLayout = new StackLayout
            {
				BackgroundColor = Color.Transparent,
                Padding = 0,                
				Orientation = StackOrientation.Horizontal,
				Children = {
					_textEntry, _postFix,
				}
			};

			// Create layout
            _layout = new RelativeLayout { IsClippedToBounds = true };

            // Position label
		 	_layout.Children.Add (_floatingLabel, () => new Rectangle(
				Device.OnPlatform<int>(0, 0, 0), 
                14, 
                _layout.Width-20, 
                _layout.Height-14));
			            
			// Position entry/postfix
            _layout.Children.Add(_entryAndPostfixLayout, () => 
				new Rectangle(
					Device.OnPlatform<int>(0, -4, -15), 
					Device.OnPlatform<int>(12, 12, 14), 
					_layout.Width - Device.OnPlatform<int>(0, -4, (string.IsNullOrWhiteSpace(Postfix) ? -34 : -15)), 
					_layout.Height - Device.OnPlatform<int>(12, 0, 2)));

			// underline
			_underlineControl = new BoxView {				
				BackgroundColor = GetCurrentPlaceholderColor(),
                InputTransparent = true
			};

			_layout.Children.Add (_underlineControl, () => new Rectangle (0, 
				Device.OnPlatform<double> (_layout.Height - 4, _layout.Height - 4, Bounds.Height - 4), 
				_layout.Width, 0.5));

			Content = _layout;
		}	    
        /// <summary>
        /// Initializes a new instance of the <see cref="FloatingLabelDemo.FloatLabelControl"/> class.
        /// </summary>
        public FloatingLabelControl()
        {
            HeightRequest    = Device.OnPlatform <int>(50, 50, 75);
            InputTransparent = false;

            // Create placeholder label
            _floatingLabel = new Label {
                BackgroundColor  = Color.Transparent,
                Text             = Placeholder,
                FontAttributes   = FontAttributes.Bold,
                XAlign           = TextAlignment.Start,
                YAlign           = TextAlignment.Center,
                FontSize         = LabelFontSize,
                Opacity          = 0.0,
                TextColor        = PlaceholderColor,
                InputTransparent = true
            };

            // Create textfield
            _textEntry = new ExtendedEntry {
                Keyboard          = this.Keyboard,
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            _textEntry.SetBinding(Entry.TextProperty, TextProperty.PropertyName, BindingMode.TwoWay);
            _textEntry.BindingContext = this;
            _textEntry.Focused       += (object sender, FocusEventArgs e) =>
            {
                UpdatePlaceholderColor();

                if (Focused != null)
                {
                    Focused(this, e);
                }
            };

            _textEntry.Unfocused += (object sender, FocusEventArgs e) =>
            {
                UpdatePlaceholderColor();

                if (Unfocused != null)
                {
                    Unfocused(this, e);
                }
            };

            _textEntry.TextChanged += TextEntry_TextChanged;

            // Postfix
            _postFix = new Label {
                BackgroundColor  = Color.Transparent,
                XAlign           = TextAlignment.Center,
                YAlign           = TextAlignment.Center,
                TextColor        = PostfixColor,
                InputTransparent = true
            };

            UpdatePostFix();

            // create stacklayout for entry and postfix
            _entryAndPostfixLayout = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Padding         = 0,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    _textEntry, _postFix,
                }
            };

            // Create layout
            _layout = new RelativeLayout {
                IsClippedToBounds = true
            };

            // Position label
            _layout.Children.Add(_floatingLabel, () => new Rectangle(
                                     Device.OnPlatform <int>(0, 0, 0),
                                     14,
                                     _layout.Width - 20,
                                     _layout.Height - 14));

            // Position entry/postfix
            _layout.Children.Add(_entryAndPostfixLayout, () =>
                                 new Rectangle(
                                     Device.OnPlatform <int>(0, -4, -15),
                                     Device.OnPlatform <int>(12, 12, 14),
                                     _layout.Width - Device.OnPlatform <int>(0, -4, (string.IsNullOrWhiteSpace(Postfix) ? -34 : -15)),
                                     _layout.Height - Device.OnPlatform <int>(12, 0, 2)));

            // underline
            _underlineControl = new BoxView {
                BackgroundColor  = GetCurrentPlaceholderColor(),
                InputTransparent = true
            };

            _layout.Children.Add(_underlineControl, () => new Rectangle(0,
                                                                        Device.OnPlatform <double> (_layout.Height - 4, _layout.Height - 4, Bounds.Height - 4),
                                                                        _layout.Width, 0.5));

            Content = _layout;
        }