public GridView GetGridView(Type type, GridViewGeneratorSettings settings = null)
        {
            var grid = new GridView();

            AddColumns(grid, type, settings);
            return(grid);
        }
        public GridView <T> GetGridView <T>(GridViewGeneratorSettings settings = null) where T : class
        {
            var grid = new GridView <T>();

            AddColumns(grid, typeof(T), settings);
            return(grid);
        }
        void AddColumns(GridView grid, Type type, GridViewGeneratorSettings settings)
        {
            if (settings == null)
            {
                settings = new GridViewGeneratorSettings();
            }
            var properties = type.GetProperties().Where(p => p.CanRead);

            foreach (var property in properties)
            {
                var cell = _converters.Select(c => c.Convert(property)).FirstOrDefault(c => c != null);
                if (cell == null)
                {
                    continue;
                }

                grid.Columns.Add(new GridColumn
                {
                    HeaderText = settings.HeaderTextDelegate?.Invoke(property),
                    DataCell   = cell
                });
            }
        }
 public static GridViewGeneratorSettings SetHeaderTextDelegate(this GridViewGeneratorSettings @this, Func <PropertyInfo, string> headerTextDelegate)
 {
     @this.HeaderTextDelegate = headerTextDelegate;
     return(@this);
 }