123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- namespace FWindSoft.Wpf
- {
- [ValueConversion(typeof(IEnumerable),typeof(string))]
- public class ItemsToStringConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var items = value as IEnumerable;
- if (items == null)
- return string.Empty;
- List<object> tempItems = new List<object>();
- foreach (var item in items)
- {
- tempItems.Add(item);
- }
- return string.Join(",", tempItems);
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|