mardi 7 avril 2015

Custom FontSize should accept string literals


Vote count:

0




I'm trying to implement a custom control that derives from DatePicker. This control will have android and iOS renderers. I need to add FontSize property for this control which I will use in renderer classes.


Here is my implementation of the FontSize property:



public static BindableProperty FontSizeProperty = BindableProperty.Create<ExDatePicker, double>(o => o.FontSize, 16d, propertyChanged: OnFontSizeChanged);

public double FontSize
{
get { return (double)GetValue(FontSizeProperty); }
set { SetValue(FontSizeProperty, value); }
}

private static void OnFontSizeChanged(BindableObject bindable, double oldvalue, double newvalue)
{
var control = bindable as ExDatePicker;
if (control != null)
{
control.FontSize = newvalue;
}
}


What I need is ability to use this property in the same way as native FontSize properties works, i.e. I need to be able to set something like



FontSize="Small"


in xaml code. Is it possible?



asked just now

Dzior

324






Custom FontSize should accept string literals

Aucun commentaire:

Enregistrer un commentaire