HuNan_NOSqlSugar/DM_Weight/Converter/TotalCountConverter.cs

34 lines
899 B
C#

using DM_Weight.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DM_Weight.Converter
{
public class TotalCountConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var total = 0;
if (value is List<ChannelStock> items)
{
foreach (var item in items)
{
var de = item as ChannelStock;
total += de.Quantity;
}
}
return total;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}