How to specify that a static type converter should be used?

JohnHardmanJohnHardman GBUniversity mod

I know that when I use SetBinding I can specify an instance of a value converter, which of course can be a static instance. However, I am just re-factoring some code and am wondering how in the following code, the
[TypeConverter(typeof(ImageSourceConverter))]
can be changed to specify that a static instance of ImageSourceConverter be used. Is there a way to do this?

    public static readonly BindableProperty SourceProperty = BindableProperty.Create(
        nameof(Source), 
        typeof(ImageSource), 
        typeof(MyAppImageButton), 
        default(ImageSource),
        propertyChanged: (bindable, oldvalue, newvalue) => ((VisualElement)bindable).ToString());

    [TypeConverter(typeof(ImageSourceConverter))]
    public ImageSource Source
    {
        get { return (ImageSource)GetValue(SourceProperty); }
        set { SetValue(SourceProperty, value); }
    }

Best Answer

Answers

Sign In or Register to comment.