46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace _20230724_MBJC_upperpc.Common
|
|||
|
|
{
|
|||
|
|
public class CenterConverterX : IMultiValueConverter
|
|||
|
|
{
|
|||
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
if (parameter == null)
|
|||
|
|
return values.Length > 1 ? (double)values[0] / 2 - (double)values[1] : (double)values[0] / 2;
|
|||
|
|
if (parameter.ToString().Equals("RightBottom"))
|
|||
|
|
return (double)values[0] - (double)values[1];
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
return (double)values[0];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class CenterConverterX_Half : IMultiValueConverter
|
|||
|
|
{
|
|||
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
return ((double)values[0] - (double)values[1]) / 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|