/// <summary>
 /// Raises the ColumnCreating event.
 /// </summary>
 /// <param name="e">A ColumnCreatingEventArgs object.</param>
 protected virtual void OnColumnCreating(DataGridViewControllerColumnEventArgs e)
 {
     if (this.ColumnCreating != null)
     {
         this.ColumnCreating(this, e);
     }
 }
        /// <summary>
        /// Initialize this controller.
        /// </summary>
        public virtual void Initialize()
        {
            string             description          = null;
            BrowsableAttribute browsable            = null;
            DataGridViewColumn column               = null;
            DataGridViewControllerColumnEventArgs e = null;

            this.DataGridView.Columns.Clear();
            this.OnPreCreateColumns();

            this.m_properties = new List <PropertyInfo>();
            foreach (PropertyInfo property in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                if (property.GetIndexParameters().Length > 0)
                {
                    continue;
                }
                browsable = (BrowsableAttribute)property.GetCustomAttributes(typeof(BrowsableAttribute), false).FirstOrDefault();
                if (browsable != null && !browsable.Browsable)
                {
                    continue;
                }
                description = ((DescriptionAttribute)Attribute.GetCustomAttribute(property, typeof(DescriptionAttribute), true) ?? new DescriptionAttribute(property.Name)).Description;

                column            = this.CreateColumn(property);
                column.Name       = property.Name;
                column.HeaderText = description;
                e = new DataGridViewControllerColumnEventArgs(column, property.Name);
                this.OnColumnCreating(e);

                if (e.Column == null)
                {
                    e.Column            = new DataGridViewTextBoxColumn();
                    e.Column.HeaderText = description;
                }
                e.Column.Name = property.Name;

                this.DataGridView.Columns.Add(e.Column);
                this.m_properties.Add(property);
            }

            this.OnPostCreateColumns();
        }