예제 #1
0
        /// <summary>
        /// change the button style when the user starts to enter a text
        /// </summary>
        /// <returns></returns>
        async Task PlaceholderToTitle()
        {
            Confirm.HeightRequest = Frame.Height;

            if (!IsValid)
            {
                Confirm.BackgroundColor = ButtonBackgroundColor.WithLuminosity(0.45);
                Confirm.TextColor       = ViewBackgroundColor;
            }

            var buttonWidth = CalculateBounds.GetTextWidth(Confirm.Text, Convert.ToSingle(Confirm.FontSize));

#if __IOS__
#endif

#if __ANDROID__
            buttonWidth *= DeviceDisplay.MainDisplayInfo.Density;
#endif
            Confirm.WidthRequest = buttonWidth;

            await Task.WhenAll(Confirm.OpacityTo(0, 1, (o) => Confirm.Opacity    = o, 300),
                               Task.Run(() => floatingLabelEntry.VerticalOptions = LayoutOptions.End));

            Confirm.HeightRequest = this.Frame.Height;
            Confirm.WidthRequest  = buttonWidth;
        }
예제 #2
0
 /// <summary>
 /// set the button style to the correct validation status
 /// </summary>
 private void UpdateValidation()
 {
     if (IsValid)
     {
         Confirm.BackgroundColor = ButtonBackgroundColor;
         Confirm.TextColor       = TextColor;
     }
     else
     {
         Confirm.BackgroundColor = ButtonBackgroundColor.WithLuminosity(0.45);
         Confirm.TextColor       = ViewBackgroundColor;
     }
 }