fix: prevent crash when invalid characters typed in coordinate editor

EditableNumberConverter.ConvertBack was throwing FormatException
when users typed '=' or other non-numeric characters, causing
WPF binding validation to crash the application on focus change.
Changed to return Binding.DoNothing to silently reject invalid input.
This commit is contained in:
tian 2026-06-03 19:49:44 +08:00
parent 0ed24b21a2
commit 6bc77672e9

View File

@ -36,7 +36,7 @@ namespace NavisworksTransport.UI.WPF.Converters
string text = value as string;
if (IsIntermediateText(text))
{
throw new FormatException("请输入有效的数字。");
return Binding.DoNothing;
}
text = text.Trim();
@ -47,7 +47,7 @@ namespace NavisworksTransport.UI.WPF.Converters
return parsedValue;
}
throw new FormatException("请输入有效的数字。");
return Binding.DoNothing;
}
public static bool IsIntermediateText(string text)