You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
|
|
using SlnMesnac.WPF.ViewModel.IndexPage;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace SlnMesnac.WPF.Converter.Generate
|
|
{
|
|
public class ConfigToDynamicGridViewConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var config = value as ColumnConfig;
|
|
if (config != null)
|
|
{
|
|
var grdiView = new GridView();
|
|
foreach (var column in config.Columns)
|
|
{
|
|
var binding = new Binding(column.DataField);
|
|
|
|
grdiView.Columns.Add(new GridViewColumn { Header = column.Header, DisplayMemberBinding = binding });
|
|
}
|
|
return grdiView;
|
|
}
|
|
return Binding.DoNothing;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
|
|
}
|