public object ConvertBack(object value, Type targetType, object parameter, string language) { double fromValue = System.Convert.ToDouble(value); Tuple <ISensorItem, IGaugeItem> tuple = (Tuple <ISensorItem, IGaugeItem>)parameter; if (tuple.Item2.GaugeType == GaugeTypeEnum.TextControl) { return(fromValue); } Units fromUnits = (Units)tuple.Item1.SensorUnits; Units toUnits = (Units)tuple.Item2.Units; if (fromUnits == toUnits) { return(fromValue); } UnitItem fromUnitItem = UnitsConverter.Find(fromUnits); UnitItem toUnitItem = UnitsConverter.Find(toUnits); return(UnitsConverter.Convert(toUnitItem, fromUnitItem, fromValue)); }