using Muchinfo.MTPClient.Data.Enums; using System; using System.Windows; using System.Windows.Data; namespace Muchinfo.MTPClient.Infrastructure.Converters { public class DirectionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is Direction)) { return TextAlignment.Left; } switch ((Direction)value) { case Direction.Ask: return TextAlignment.Right; case Direction.Bid: return TextAlignment.Left; } //默认左对齐 return TextAlignment.Left; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }