static SignaturePadView() { StrokeColorProperty = BindableProperty.Create( nameof(StrokeColor), typeof(Color), typeof(SignaturePadView), ImageConstructionSettings.DefaultStrokeColor, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePadCanvas.StrokeColor = (Color)newValue); StrokeWidthProperty = BindableProperty.Create( nameof(StrokeWidth), typeof(float), typeof(SignaturePadView), ImageConstructionSettings.DefaultStrokeWidth, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePadCanvas.StrokeWidth = (float)newValue); SignatureLineColorProperty = BindableProperty.Create( nameof(SignatureLineColor), typeof(Color), typeof(SignaturePadView), SignaturePadDarkColor, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignatureLine.Color = (Color)newValue); SignatureLineWidthProperty = BindableProperty.Create( nameof(SignatureLineWidth), typeof(double), typeof(SignaturePadView), DefaultLineWidth, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignatureLine.HeightRequest = (double)newValue); SignatureLineSpacingProperty = BindableProperty.Create( nameof(SignatureLineSpacing), typeof(double), typeof(SignaturePadView), DefaultNarrowSpacing, propertyChanged: OnPaddingChanged); CaptionTextProperty = BindableProperty.Create( nameof(CaptionText), typeof(string), typeof(SignaturePadView), DefaultCaptionText, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).CaptionLabel.Text = (string)newValue); CaptionFontSizeProperty = BindableProperty.Create( nameof(CaptionFontSize), typeof(double), typeof(SignaturePadView), DefaultFontSize, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).CaptionLabel.FontSize = (double)newValue); CaptionTextColorProperty = BindableProperty.Create( nameof(CaptionTextColor), typeof(Color), typeof(SignaturePadView), SignaturePadDarkColor, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).CaptionLabel.TextColor = (Color)newValue); PromptTextProperty = BindableProperty.Create( nameof(PromptText), typeof(string), typeof(SignaturePadView), DefaultPromptText, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePrompt.Text = (string)newValue); PromptFontSizeProperty = BindableProperty.Create( nameof(PromptFontSize), typeof(double), typeof(SignaturePadView), DefaultFontSize, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePrompt.FontSize = (double)newValue); PromptTextColorProperty = BindableProperty.Create( nameof(PromptTextColor), typeof(Color), typeof(SignaturePadView), SignaturePadDarkColor, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePrompt.TextColor = (Color)newValue); ClearTextProperty = BindableProperty.Create( nameof(ClearText), typeof(string), typeof(SignaturePadView), DefaultClearLabelText, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).ClearLabel.Text = (string)newValue); ClearFontSizeProperty = BindableProperty.Create( nameof(ClearFontSize), typeof(double), typeof(SignaturePadView), DefaultFontSize, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).ClearLabel.FontSize = (double)newValue); ClearTextColorProperty = BindableProperty.Create( nameof(ClearTextColor), typeof(Color), typeof(SignaturePadView), SignaturePadDarkColor, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).ClearLabel.TextColor = (Color)newValue); BackgroundImageProperty = BindableProperty.Create( nameof(BackgroundImage), typeof(ImageSource), typeof(SignaturePadView), default(ImageSource), propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).BackgroundImageView.Source = (ImageSource)newValue); BackgroundImageAspectProperty = BindableProperty.Create( nameof(BackgroundImageAspect), typeof(Aspect), typeof(SignaturePadView), Aspect.AspectFit, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).BackgroundImageView.Aspect = (Aspect)newValue); BackgroundImageOpacityProperty = BindableProperty.Create( nameof(BackgroundImageOpacity), typeof(double), typeof(SignaturePadView), 1.0, propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).BackgroundImageView.Opacity = (double)newValue); ClearedCommandProperty = BindableProperty.Create( nameof(ClearedCommand), typeof(ICommand), typeof(SignaturePadView), default(ICommand)); StrokeCompletedCommandProperty = BindableProperty.Create( nameof(StrokeCompletedCommand), typeof(ICommand), typeof(SignaturePadView), default(ICommand)); IsBlankPropertyKey = BindableProperty.CreateReadOnly( nameof(IsBlank), typeof(bool), typeof(SignaturePadView), true); IsBlankProperty = IsBlankPropertyKey.BindableProperty; }
public void SetValueFromRenderer(BindablePropertyKey propertyKey, object value) { controller.SetValueFromRenderer(propertyKey, value); }
void IElementController.SetValueFromRenderer(BindablePropertyKey property, object value) { SetValueCore(property, value); }