diff --git a/LiveSPICE/LiveSimulation.xaml b/LiveSPICE/LiveSimulation.xaml index 066334a0..641d9d6f 100644 --- a/LiveSPICE/LiveSimulation.xaml +++ b/LiveSPICE/LiveSimulation.xaml @@ -95,7 +95,7 @@ - + @@ -121,6 +121,17 @@ + + + @@ -128,7 +139,7 @@ Text="Gain: " TextAlignment="Right" VerticalAlignment="Center" /> @@ -160,7 +171,7 @@ - + diff --git a/LiveSPICE/Utils/dBConverter.cs b/LiveSPICE/Utils/dBConverter.cs index c56978ca..5c76bd29 100644 --- a/LiveSPICE/Utils/dBConverter.cs +++ b/LiveSPICE/Utils/dBConverter.cs @@ -12,7 +12,11 @@ public object Convert(object value, Type targetType, object parameter, CultureIn } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - return Math.Pow(10, (double)value / 20); + if (value is string s && double.TryParse(s, out var dbValue)) + { + return Math.Pow(10, dbValue / 20); + } + return value; } } }