Пример #1
0
        private void SortGrid(EntityGridViewSort sorting)
        {
            if (sorting == null)
            {
                return;
            }

            switch (sorting.SortOrder)
            {
            case SortOrder.Ascending:
                dataGrid.Sort(dataGrid.Columns[sorting.SortedColumn], ListSortDirection.Ascending);
                break;

            case SortOrder.Descending:
                dataGrid.Sort(dataGrid.Columns[sorting.SortedColumn], ListSortDirection.Descending);
                break;
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
 public void Initialize(Type entType, IList entList, EntityGridViewSort entityGridViewSort)
 {
     Initialize(entType, entList, null, entityGridViewSort);
 }