private void UnrealizeItems() { var window = GetRealizationWindow(); foreach (var item in MainPanel.Children) { var itemTop = Canvas.GetTop(item); if (itemTop < window.Top || itemTop > window.Bottom) { MainPanel.Children.Remove(item); GalleryThumbnailTemplate container = item as GalleryThumbnailTemplate; (container.Tag as LayoutInfo).IsRendered = false; containerCache.Put(container); } } }
private void RealizeOneItem(LayoutInfo i) { //if (i.IsRendered) // return; var container = containerCache.Get(); if (container == null) { container = new GalleryThumbnailTemplate(); } container.Tapped += Container_Tapped; container.SetLayout(i.Content); container.Tag = i; Canvas.SetLeft(container, i.Left); Canvas.SetTop(container, i.Top); MainPanel.Children.Add(container); i.IsRendered = true; }
private async void RealizeOneItem(LayoutInfo i) { var availableSize = await GetAvailableSize(); var container = containerCache.Get(); if (container == null) { container = new GalleryThumbnailTemplate(); } container.Tapped += Container_Tapped; container.SetLayout(availableSize, i.Content); container.Tag = i; Canvas.SetLeft(container, i.Left); Canvas.SetTop(container, i.Top); MainPanel.Children.Add(container); i.IsRendered = true; }