I have this code (which works just right):
I just found an even more generic solution with this markup extension:
public class SystemTypeExtension : MarkupExtension
{
private object parameter;
public int Int{set { parameter = value; }}
public double Double { set { parameter = value; } }
public float Float { set { parameter = value; } }
public bool Bool { set { parameter = value; } }
// add more as needed here
public override object ProvideValue(IServiceProvider serviceProvider)
{
return parameter;
}
}
Usage ("wpf:" is the namespace where the extension lives in):
You even get the options True and False after typing Bool= and type safety!