I have a generic class implementing IValueConverter
. Something like:
class MyValueConverter : IValueConverter
With XAML 2
You could probably do this with a custom MarkupExtension(archive)(v4). Something like:
public class MyMarkupExtension : MarkupExtension {
public MyMarkupExtension() {
this.Type = /* some default type */;
}
public MyMarkupExtension(Type type) {
this.Type = type;
}
public Type Type { get; private set; }
public override object ProvideValue(IServiceProvider serviceProvider) {
Type type = typeof(MyValueConverter<>).MakeGenericType(this.Type);
return Activator.CreateInstance(type);
}
}
Then you'd use it like {Binding ... Converter={local:MyMarkup {x:Type BounceEase}}}