Closed sa-he closed 2 years ago
Ok. Can you maybe prepare a minimal PR so I can see how you’d add it - and how you’d use it? Is there a concrete use-case for these annotations? You cannot add it to generic classes, right?
No, generic types cannot be used in attributes. This is why I suggest to add the attribute to all child classes instead of base classes.
Use-case? A. It helps consumers of the lib to understand the input and outcome of the converter. B. We have developed the idea of cascading converters (https://github.com/thomasgalliker/ValueConverters.NET/issues/12) in a less intrusive way. Meaning that existing converters do not need to have a reference to a 'PreviousConverter'. This implementation relies on the ValueConversionAttribute and is used like this:
`
<conv:Int32ToBoolean />
<conv:BoolInverter />
<conv:BooleanToVisibility />
</conv:ValueConverterGroup>`
I would provide a PR if you are intrested. Otherwise adding the ValueConvertionAttribute to your converters allows us to place them inside our ValueConverterGroup
.
Is it possible to add the
ValueConversionAttribute
to the converters? AFAIK it is only available in net full framework and netcore so compiler-ifs would be required.I could send a pull request if you agree.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.data.valueconversionattribute?view=netframework-4.8