public static void MakeConverter(this ResourceDictionary dic, string key, ConvertDelegate convert, ConvertBackDelegate convertBack = null) { var conv = new ValueConverterGenerator(convert, convertBack); dic.Add(key, conv); }
public static void MakeConverter(this ResourceDictionary dic, string key, Func <object, object, object> convert, ConvertBackDelegate convertBack = null) { var conv = new ValueConverterGenerator((object value, Type targetType, object parameter, CultureInfo culture) => { return(convert(value, parameter)); } , convertBack); dic.Add(key, conv); }
public static void WriteValueConverters() { var settings = Settings(); foreach (var quantity in settings.Quantities) { File.WriteAllText($"C:\\Git\\_GuOrg\\Gu.Units\\Gu.Units.Wpf\\{quantity.Name}Converter.generated.cs", ValueConverterGenerator.Code(quantity)); } }