Ejemplo n.º 1
0
        internal void AddRow()
        {
            var maxColumnCount = Rows.Max(c => c.Cells.Count);
            var rowsCount      = Rows.Count;
            var row            = new RowDefinition();

            for (int j = 0; j < maxColumnCount; j++)
            {
                if (this.rnd.Next(100) < 30)
                {
                    var cell = new ComplexCell();
                    cell.Value      = FormattableString.Invariant($"Some cell {rowsCount},{j}");
                    cell.IsEditable = j % 4 == 0;
                    cell.Child      = new CellDefinition()
                    {
                        Value = "Nested cell " + maxColumnCount
                    };
                    row.Cells.Add(cell);
                }
                else
                {
                    var cell = new CellDefinition();
                    cell.Value      = FormattableString.Invariant($"Some cell {rowsCount},{j}");
                    cell.IsEditable = j % 2 == 0;
                    row.Cells.Add(cell);
                }
            }

            Rows.Add(row);
        }
Ejemplo n.º 2
0
        public ViewModel()
        {
            for (int i = 0; i < ViewModel.ROWS_COUNT; i++)
            {
                var row = new RowDefinition();
                for (int j = 0; j < 5; j++)
                {
                    if (j == 0)
                    {
                        var cell = new FirstColCell();
                        cell.Value      = FormattableString.Invariant($"Some cell {i},{j}");
                        cell.IsEditable = this.rnd.Next(15) % 2 == 0;
                        cell.RowIndex   = i;
                        row.Cells.Add(cell);
                    }
                    else if (this.rnd.Next(100) < 30)
                    {
                        var cell = new ComplexCell();
                        cell.Value      = FormattableString.Invariant($"Some cell {i},{j}");
                        cell.IsEditable = this.rnd.Next(15) % 2 == 0;
                        cell.Child      = new CellDefinition()
                        {
                            Value = "Nested cell " + i
                        };
                        row.Cells.Add(cell);
                    }
                    else
                    {
                        var cell = new CellDefinition();
                        cell.Value      = FormattableString.Invariant($"Some cell {i},{j}");
                        cell.IsEditable = this.rnd.Next(15) % 2 == 0;
                        row.Cells.Add(cell);
                    }
                }

                Rows.Add(row);
            }
        }