17 lines
555 B
C#
17 lines
555 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace XplorePlane.Views
|
|
{
|
|
/// <summary>返回输入值的一半,用于十字线居中定位</summary>
|
|
public class HalfValueConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> value is double d ? d / 2.0 : 0.0;
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> throw new NotSupportedException();
|
|
}
|
|
}
|