[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public abstract class HandlerAttribute : Attribute
{
- protected HandlerAttribute(Type handler, Type target, Type[] supportedVisuals = null)
+ protected HandlerAttribute(Type handler, Type target) : this(handler, target, null)
+ {
+ }
+
+ protected HandlerAttribute(Type handler, Type target, Type[] supportedVisuals)
{
SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualMarker.DefaultVisual) };
TargetType = target;
{
public partial class VisualElement : NavigableElement, IAnimatable, IVisualElementController, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController
{
+
+ public new static readonly BindableProperty NavigationProperty = NavigableElement.NavigationProperty;
+
+ public new static readonly BindableProperty StyleProperty = NavigableElement.StyleProperty;
+
public static readonly BindableProperty InputTransparentProperty = BindableProperty.Create("InputTransparent", typeof(bool), typeof(VisualElement), default(bool));
public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool),
UpdateBackgroundColor();
}
- protected override void UpdateTextColor() => ApplyTheme();
+ protected override void UpdateColor() => ApplyTheme();
protected override void UpdateBackgroundColor()
{
_textInputLayout.BoxBackgroundColor = MaterialColors.CreateEntryFilledInputBackgroundColor(Element.BackgroundColor, Element.TextColor);
}
- protected internal override void UpdatePlaceHolderText() => _textInputLayout.SetHint(Element.Placeholder, Element);
+ protected override void UpdatePlaceHolderText() => _textInputLayout.SetHint(Element.Placeholder, Element);
protected override EditText EditText => _textInputEditText;
protected override void UpdatePlaceholderColor() => ApplyTheme();
- void ApplyTheme() => _textInputLayout?.ApplyTheme(Element.TextColor, Element.PlaceholderColor);
+ void ApplyTheme(Color textColor) => _textInputLayout?.ApplyTheme(textColor, Element.PlaceholderColor);
+ void ApplyTheme() => ApplyTheme(Element.TextColor);
- protected internal override void UpdateFont()
+ protected override void UpdateTextColor(Color color)
+ {
+ ApplyTheme(color);
+ }
+
+ protected override void UpdateFont()
{
base.UpdateFont();
_textInputLayout.Typeface = Element.ToTypeface();
_textInputEditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
}
+
}
}
#endif
\ No newline at end of file
{
protected override MaterialTextField CreateNativeControl() => new MaterialTextField(this, Element);
protected override void SetBackgroundColor(Color color) => ApplyTheme();
- protected internal override void UpdateColor() => Control?.UpdateTextColor(this);
+ protected override void UpdateColor() => Control?.UpdateTextColor(this);
protected virtual void ApplyTheme() => Control?.ApplyTheme(this);
- protected internal override void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
+ protected override void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
- protected internal override void UpdateFont()
+ protected override void UpdateFont()
{
base.UpdateFont();
Control?.ApplyTypographyScheme(Element);
_hintColorSwitcher.UpdateTextColor(EditText, Element.PlaceholderColor, EditText.SetHintTextColor);
}
- protected override void UpdateTextColor()
+ protected override void UpdateColor()
+ {
+ UpdateTextColor(Element.TextColor);
+ }
+
+ protected override void UpdateTextColor(Color color)
{
_textColorSwitcher = _textColorSwitcher ?? new TextColorSwitcher(EditText.TextColors, Element.UseLegacyColorManagement());
- _textColorSwitcher.UpdateTextColor(EditText, Element.TextColor);
+ _textColorSwitcher.UpdateTextColor(EditText, color);
}
}
EditText.Text = Element.Text;
UpdateInputType();
- UpdateTextColor();
+ UpdateColor();
UpdateAlignment();
UpdateFont();
UpdatePlaceholderColor();
}
- internal protected virtual void UpdatePlaceHolderText() => EditText.Hint = Element.Placeholder;
+ protected virtual void UpdatePlaceHolderText() => EditText.Hint = Element.Placeholder;
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
}
}
else if (e.PropertyName == Entry.TextColorProperty.PropertyName)
- UpdateTextColor();
+ UpdateColor();
else if (e.PropertyName == InputView.KeyboardProperty.PropertyName)
UpdateInputType();
else if (e.PropertyName == InputView.IsSpellCheckEnabledProperty.PropertyName)
EditText.UpdateHorizontalAlignment(Element.HorizontalTextAlignment, Context.HasRtlSupport());
}
- abstract protected void UpdateTextColor();
+ protected abstract void UpdateColor();
+ protected abstract void UpdateTextColor(Color color);
- protected internal virtual void UpdateFont()
+ protected virtual void UpdateFont()
{
EditText.Typeface = Element.ToTypeface();
EditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
PickerManager.Init(this);
}
+ public PickerEditText(Context context, IPickerRenderer pickerRenderer) : this(context)
+ {
+
+ }
+
public override bool OnTouchEvent(MotionEvent e)
{
PickerManager.OnTouchEvent(this, e);
{
public static class Extensions
{
+ public static void ApplyKeyboard(this IUITextInput textInput, Keyboard keyboard)
+ {
+ if(textInput is IUITextInputTraits traits)
+ ApplyKeyboard(traits, keyboard);
+ }
+
public static void ApplyKeyboard(this IUITextInputTraits textInput, Keyboard keyboard)
{
textInput.AutocapitalizationType = UITextAutocapitalizationType.None;
{
public static class ToolbarItemExtensions
{
+ public static UIKit.UIBarButtonItem ToUIBarButtonItem(this Xamarin.Forms.ToolbarItem item, bool forceName)
+ {
+ return ToUIBarButtonItem(item, false, false);
+ }
+
public static UIBarButtonItem ToUIBarButtonItem(this ToolbarItem item, bool forceName = false, bool forcePrimary = false)
{
if (item.Order == ToolbarItemOrder.Secondary && !forcePrimary)
Control.TextAlignment = Element.HorizontalTextAlignment.ToNativeTextAlignment(((IVisualElementController)Element).EffectiveFlowDirection);
}
- protected internal virtual void UpdateColor()
+ protected virtual void UpdateColor()
{
var textColor = Element.TextColor;
Control.AdjustsFontSizeToFitWidth = Element.OnThisPlatform().AdjustsFontSizeToFitWidth();
}
- protected internal virtual void UpdateFont()
+ protected virtual void UpdateFont()
{
if (initialSize == CGSize.Empty)
{
Control.SecureTextEntry = Element.IsPassword;
}
- protected internal virtual void UpdatePlaceholder()
+ protected virtual void UpdatePlaceholder()
{
var formatted = (FormattedString)Element.Placeholder;