public void AddBookmark(string url, string title, TabView tv, MainWindow mw) { if (ItemsCount != 3) { bookmarkItem = new BookmarkItem(url, title, tv, mainWindow, this); Canvas canvas1 = new Canvas(); mainCanvas.Children.Add(canvas1); Canvas.SetTop(canvas1, RowsCount * 105); Canvas.SetLeft(bookmarkItem, ItemsCount * 177); bookmarkItem.Width = bookmarkWidth; bookmarkItem.Height = bookmarkHeight; canvas1.Children.Add(bookmarkItem); ItemsCount += 1; if (ItemsCount == 3) { ItemsCount = 0; RowsCount += 1; } if (RowsCount >= 3) { mainCanvas.Height = (RowsCount + 1) * 110; } } }
public void AddBookmark(string title, string url, MainWindow mw) { BookmarkItem hi = new BookmarkItem(title, url, this, mw); content.Children.Add(hi); hi.Margin = new Thickness(0, ItemsCount * ItemHeight, 0, 0); ItemsCount += 1; }