mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
Update IntRangeValueConverter.cs
This commit is contained in:
parent
a845d33205
commit
0a90a0cfec
1 changed files with 6 additions and 1 deletions
|
|
@ -40,7 +40,12 @@ namespace ServerManagerTool.Common.Converters
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
var sliderValue = System.Convert.ToInt32(value);
|
if (value is null || value.ToString() == string.Empty)
|
||||||
|
return default;
|
||||||
|
|
||||||
|
if (!int.TryParse(value.ToString(), out int sliderValue))
|
||||||
|
return default;
|
||||||
|
|
||||||
sliderValue = Math.Max(MinValue, sliderValue);
|
sliderValue = Math.Max(MinValue, sliderValue);
|
||||||
sliderValue = Math.Min(MaxValue, sliderValue);
|
sliderValue = Math.Min(MaxValue, sliderValue);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue