예제 #1
0
        public void Position_Of_Child_in_Grid_1_1_is_0_0()
        {
            // Arrange
            var gridLayoutModel = new GridLayoutModel(1, 1);

            // Act
            var position = gridLayoutModel.GetGridPositionBy(3);

            // Assert
            Assert.AreEqual(0, position.Row);
            Assert.AreEqual(0, position.Col);
        }
예제 #2
0
        public void Position_Of_Child_7__in_Grid_2_3_is_0_1()
        {
            // Arrange
            var gridLayoutModel = new GridLayoutModel(2, 3);

            // Act
            var position = gridLayoutModel.GetGridPositionBy(7);

            // Assert
            Assert.AreEqual(0, position.Row);
            Assert.AreEqual(1, position.Col);
        }
예제 #3
0
        private void PlaceGridCell(int rows, int cols)
        {
            var childrenCount   = Grid.Children.Count;
            var gridLayoutModel = new GridLayoutModel(rows, cols);

            for (int i = 0; i < childrenCount; i++)
            {
                var gridPosition = gridLayoutModel.GetGridPositionBy(i);
                var child        = Grid.Children[i];
                Grid.SetRow(child, gridPosition.Row);
                Grid.SetColumn(child, gridPosition.Col);
            }
        }