public void PopulateThumbnailBoxes(ICollection <ThumbnailInfo> thumbnails) { foreach (var aThumbnail in thumbnails) { var aThumbnailBox = new ThumbnailBox(aThumbnail); aThumbnail.ThumbnailBox = aThumbnailBox; aThumbnailBox.ThumbnailBoxClicked += (sender, e) => { var thumbnailBox = sender as ThumbnailBox; if (thumbnailBox.IsSelected) { DisplayImage(); } else { SelectThumbnailBox(thumbnailBox); } }; _thumbnailBoxList.Add(aThumbnailBox); if (_thumbnailBoxList.Count == 1) { SelectThumbnailBox(aThumbnailBox); _thumbnailScrollViewer.Focus(); } var aSurroundingStackPanel = new StackPanel(); aSurroundingStackPanel.Children.Add(aThumbnailBox); _thumbnailWrapPanel.Children.Add(aSurroundingStackPanel); } }
private void SelectThumbnailBox(ThumbnailBox thumbnailBox) { if (_selectedThumbnailBox != thumbnailBox) { if (_selectedThumbnailBox != null) { _selectedThumbnailBox.UnselectThumbnail(); } _selectedThumbnailBox = thumbnailBox; _selectedThumbnailIndex = _thumbnailBoxList .FindIndex(aThumbnailBox => aThumbnailBox == _selectedThumbnailBox); _selectedThumbnailBox.SelectThumbnail(); } }
private void AdvanceToThumbnailIndex(int increment) { if (_selectedThumbnailBox != null) { var newSelectedThumbnailIndex = _selectedThumbnailIndex + increment; if ((newSelectedThumbnailIndex >= 0) && (newSelectedThumbnailIndex < _thumbnailBoxList.Count)) { _selectedThumbnailBox.UnselectThumbnail(); _selectedThumbnailIndex = newSelectedThumbnailIndex; _selectedThumbnailBox = _thumbnailBoxList[_selectedThumbnailIndex]; _selectedThumbnailBox.SelectThumbnail(); } } }
public GeneratingEventArgs(ThumbnailBox tb) { this._tb = tb; }
public GeneratingEventArgs(ThumbnailBox tb) { this._tb = tb; }
public void RefreshThumbnail() => ThumbnailBox.Refresh();