public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) { if( parameter.ToString() == "Height" ) _originalValue = new Dimension( double.Parse( value.ToString() ), _originalValue.Weight ); if( parameter.ToString() == "Weight" ) _originalValue = new Dimension( _originalValue.Height, double.Parse( value.ToString() ) ); return _originalValue; }
static Dimension _originalValue; // the static struct that stores original value at the start of editing public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) { _originalValue = ( ( Dimension )value ); if( parameter.ToString() == "Height" ) return ( ( Dimension )value ).Height; if( parameter.ToString() == "Weight" ) return ( ( Dimension )value ).Weight; return _originalValue; }