public void SetImage(ImageGrid grid) { var img = grid.GetSelectImage(); if (img.Image != null) { selectedPicturePreviewBox.Image = grid.GetBitmapImage(); CurrentImage = grid.GetSelectImage(); CurrentImageIndex = grid.SelectedIndex; } else { selectedPicturePreviewBox.Image = null; CurrentImage = null; CurrentImageIndex = 0; } }