|
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Globalization;
- using System.Linq;
- using System.Windows.Data;
- using System.Windows.Media;
-
- namespace BPASmartClient.DosingSystem.Converter
- {
- public class DataTableRedundantConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null && value is bool bit)
- {
- if (bit)
- return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98));
- else
- return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231));
- }
- return default;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-
- public static class ObserDo
- {
- /// <summary>
- /// 倒叙插入
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="collection"></param>
- /// <param name="items"></param>
- public static void AddRange<T>(this ObservableCollection<T> collection, IEnumerable<T> items)
- {
- if (items!=null&&items.Count<T>()!=0)
- {
- for (int i = items.Count<T>()-1; i >=0; i--)
- {
- collection.Insert(0,items.ElementAt(i));
- }
- }
-
-
- }
- }
- }
|