30 lines
779 B
C#
30 lines
779 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
namespace Yunda.SOMS.DataMonitoringServer.Viewport.Domain.Converters
|
|
{
|
|
public class MyConverter : IValueConverter
|
|
{
|
|
public object Convert(object o, Type type,
|
|
object parameter, CultureInfo culture)
|
|
{
|
|
var date = (DateTime)o;
|
|
switch (type.Name)
|
|
{
|
|
case "String":
|
|
return date.ToString("F", culture);
|
|
|
|
case "Brush":
|
|
return Brushes.Red;
|
|
|
|
default:
|
|
return o;
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object o, Type type,
|
|
object parameter, CultureInfo culture) => null;
|
|
}
|
|
} |