I want to create a generic data type converter in my WPF application like this class template:
[ValueConversion(typeof(T), typeof(string))]
class DataTypeConverter<T> : IValueConverter
to convert data types like int, double, byte, ushort to string and vice versa and use it in two way bindings of different property types of my classess, and then simply create any type by this single line of code:
class ushortTypeConverter : DataTypeConverter<ushort>{}
and if possible shows validation message in textboxes that is bound in the case of wrong input.
Is it possible to write such a class template?