コード例 #1
0
ファイル: EntityGridView.cs プロジェクト: silvarui/Honeywell
        public void Initialize(Type entType, IList entList, IEntityGridViewEnabledCell entGridViewEnabledCell, EntityGridViewSort entityGridViewSort)
        {
            ClearGridData();

            entityList = entList;
            entityType = entType;
            entityGridViewEnabledCell = entGridViewEnabledCell;

            //get the first entity to use to create headers and retrieve the type
            Entity entity = ((entList != null && entList.Count > 0) ? (Entity)entList[0] : null);

            if (entity == null)
            {
                entity = (Entity)Activator.CreateInstance(entType);
            }

            //set the default row height
            dataGrid.RowTemplate.Height = MinRowHeight;

            if (this.lastWidth != GridWidth())
            {
                ColumnInfos = null;
            }

            if (ColumnInfos == null)
            {
                GetDefaultColumnInfos(entity); //reads the entity's column names to be displayed in the gid
            }
            CreateGridColumns(entity);         //creates grid's columns
            PopulateGrid();                    //populate grid with rows (if the initial entity list passed was not empty)

            //if (HasContextMenu)
            //    FillContextMenu(); //fill context menu
            dataGrid.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText;

            SelectEntity(null);

            SortGrid(entityGridViewSort);

            this.lastWidth = GridWidth();
        }
コード例 #2
0
ファイル: EntityGridView.cs プロジェクト: silvarui/Honeywell
 public void Initialize(Type entType, IList entList, IEntityGridViewEnabledCell entGridViewEnabledCell)
 {
     Initialize(entType, entList, null, null);
 }