Ejemplo n.º 1
0
        public GridVector Measure(GridMeasure available, GridLayoutModel model)
        {
            var row    = RowIndex.From(1);
            var column = ColumnIndex.From(1);

            return(GridVector.Create(row, column));
        }
Ejemplo n.º 2
0
        public GridVector Measure(GridMeasure available, GridLayoutModel model)
        {
            var first = model.Measure(First, available);

            available = available.Reduce(first);

            var second = model.Measure(Second, available);

            return(GridVector.Create(first.Row + second.Row, first.Column.Max(second.Column)));
        }
        void Initialize()
        {
            _inner.CellClick += (sender, ev) =>
            {
                var row    = RowIndex.From(ev.RowIndex);
                var column = ColumnIndex.From(ev.ColumnIndex);
                var index  = GridVector.Create(row, column);

                foreach (var elementKey in _layoutModel.Locate(index))
                {
                    var vCell = _lastGrid.FindCell(elementKey);
                    if (vCell == null)
                    {
                        continue;
                    }

                    var action = vCell.Attributes["A_ON_CLICK"] as Action;
                    if (action == null)
                    {
                        continue;
                    }

                    _dispatch(vCell.ElementKey, action);
                }
            };

            _inner.CellValueChanged += (sender, ev) =>
            {
                var row    = RowIndex.From(ev.RowIndex);
                var column = ColumnIndex.From(ev.ColumnIndex);
                var index  = GridVector.Create(row, column);

                foreach (var elementKey in _layoutModel.Locate(index))
                {
                    var vCell = _lastGrid.FindCell(elementKey);
                    if (vCell == null)
                    {
                        continue;
                    }

                    var action = vCell.Attributes["A_ON_CHANGED"] as Action <object>;
                    if (action == null)
                    {
                        continue;
                    }

                    var value = _inner.Rows[row.Row].Cells[column.Column].Value;

                    _dispatch(vCell.ElementKey, () => action(value));
                }
            };
        }