예제 #1
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);
        }
예제 #2
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();
        }