Esempio n. 1
0
        private void CreateGridCells()
        {
            var rows = _collectionProperties["Rows"].Items.ToArray();

            PropertiesNodes.Clear();

            var rowsContainer = new GridPanelRowConstructor(rows);


            for (var i = 0; i < rowsContainer.GetRowCount(); i++)
            {
                Panels.Add(CreatePanel());
                //регистрируем строку грида в инспекторе объектов
                //создаем контейнер объектов
                RegisterGridPanelRowInInspector(i);
            }

            for (var i = 0; i < Panels.Count(); i++)
            {
                _memento.BeginUpdate();
                ObjectInspector.FocusedPropertiesNode = PropertiesNodes[i];

                var cells = rowsContainer.GetCells(i); //DesignerExtensions.GetCollection(rows[i], "Cells").ToList();

                //устанавливаем количество столбцов, соответствующее суммарном количеству столбцов в строке
                var columnSpan = cells.Select(s => Convert.ToInt32(s.ColumnSpan)).Cast <int>().ToList();

                //устанавливаем для строки количество столбцов
                Panels[i].SetColumnSpan(columnSpan);

                _memento.EndUpdate();
            }
        }
Esempio n. 2
0
        public dynamic GetLayout()
        {
            var instanceLayout = new DynamicWrapper();

            this.SetSimplePropertiesToInstance(instanceLayout);

            var rowIndex = 0;

            var rows          = _collectionProperties["Rows"].Items.ToArray();
            var rowsContainer = new GridPanelRowConstructor(rows);

            foreach (var row in _collectionProperties["Rows"].Items)
            {
                row.Cells = DesignerExtensions.GetCollection(row, "Cells");

                var cellsList = new List <dynamic>();
                for (var i = 0; i < row.Cells.Count(); i++)
                {
                    var gridCellMap = rowsContainer.GetCellMap(rowIndex, i);

                    var controlName =
                        Panels[gridCellMap.InnerRowIndex].GetCell(gridCellMap.InnerColumnIndex).GetPropertyName();
                    var controlLayout =
                        Panels[gridCellMap.InnerRowIndex].GetCell(gridCellMap.InnerColumnIndex).GetLayout();

                    if (!String.IsNullOrEmpty(controlName) && controlLayout != null)
                    {
                        var cell = row.Cells[i];
                        cell.ColumnSpan   = Convert.ToInt32(cell.ColumnSpan);
                        cell[controlName] = controlLayout;
                        cellsList.Add(cell);
                    }
                }
                row.Cells = cellsList;
                rowIndex++;
            }

            instanceLayout["Rows"] = _collectionProperties["Rows"].Items;

            return(instanceLayout);
        }
Esempio n. 3
0
        public void SetLayout(dynamic value)
        {
            _memento.BeginUpdate();

            var rows            = _collectionProperties["Rows"].Items;
            var gridConstructor = new GridPanelRowConstructor(rows.ToArray());

            for (var rowIndex = 0; rowIndex < rows.Count; rowIndex++)
            {
                var row = rows[rowIndex];

                for (var columnIndex = 0; columnIndex < row.Cells.Count; columnIndex++)
                {
                    var gridCellMap = gridConstructor.GetCellMap(rowIndex, columnIndex);

                    ObjectInspector.FocusedPropertiesNode =
                        PropertiesNodes[gridCellMap.InnerRowIndex].Children[gridCellMap.InnerColumnIndex];

                    Panels[gridCellMap.InnerRowIndex].GetCell(gridCellMap.InnerColumnIndex)
                    .SetLayout(row.Cells[columnIndex].Items);
                }
            }
            _memento.EndUpdate();
        }