private void ReArrangeRowBooks() { this.RowUnit.ColumnDefinitions.Clear(); for (int i = 0; i < ShelfRowBooks.BOOKS_PER_ROW; i++) { this.RowUnit.ColumnDefinitions.Add(new ColumnDefinition()); } for (int i = 0; i < this.BooksRow.BookCount; i++) { BookItemView bookItem = new BookItemView(); bookItem.Margin = new Thickness(10.0, 10.0, 10.0, 2.0); bookItem.BookItem = this.BooksRow.Books[i]; bookItem.ItemClicked += OnClickBookItem; bookItem.ItemRemoved += OnBookItemRemoved; bookItem.CanRemoveBookItem = BooksRow.CanRemoveBooks; this.RowUnit.Children.Add(bookItem); Grid.SetColumn(bookItem, i); } }