Ejemplo n.º 1
0
        protected override void OnAttached()
        {
            try
            {
                if (Control is FormsComboBox)
                {
                    FormsComboBox control = Control as FormsComboBox;

                    // native picker style
                    control.Style = (Xaml.Style)Xaml.Application.Current.Resources["ComboBoxStyle"] as Xaml.Style;
                    control.ItemContainerStyle = Xaml.Application.Current.Resources["ComboBoxItemStyle"] as Xaml.Style;
                    if (!string.IsNullOrWhiteSpace(ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element)))
                    {
                        control.PlaceholderText = ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element);
                    }
                }
                else if (Control is TextBox)
                {
                    TextBox control = Control as TextBox;
                    control.Style = (Xaml.Style)Xaml.Application.Current.Resources["TextBoxStyle"] as Xaml.Style;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
 private void InsertPlaceHolder()
 {
     if (!string.IsNullOrWhiteSpace(ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element)))
     {
         var placeHolder = new NSAttributedString(ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element), new UIStringAttributes()
         {
             ForegroundColor = UIColor.FromRGB(38, 50, 56)
         });
         control.AttributedPlaceholder = placeHolder;
     }
 }
Ejemplo n.º 3
0
 protected override void OnAttached()
 {
     try
     {
         control = Control as EditText;
         control.SetBackgroundResource(Resource.Drawable.CustomPicker);
         control.SetPadding(10, 0, 10, 0);
         control.SetHintTextColor(global::Android.Graphics.Color.Rgb(38, 50, 56));
         control.Gravity = GravityFlags.CenterVertical;
         control.SetForegroundGravity(GravityFlags.CenterVertical);
         control.SetTextColor(global::Android.Graphics.Color.White);
         if (!string.IsNullOrWhiteSpace(ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element)))
         {
             control.Hint = ApplyFormEntryNativeStyleEffect.GetPlaceHolderText(Element);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }