18 lines
392 B
C#
18 lines
392 B
C#
|
|
namespace AntdWpf.Converters;
|
|||
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Globalization;
|
|||
|
|
public class DivisionConverter : ArithmeticConverter
|
|||
|
|
{
|
|||
|
|
public override double Convert(double value, Type targetType, double parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
// Divisor cannot be 0
|
|||
|
|
if (parameter == 0.0)
|
|||
|
|
{
|
|||
|
|
return value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return value / parameter;
|
|||
|
|
}
|
|||
|
|
}
|