private void OnDownloadCompleted(object sender, EventArgs args) { var phandler = PropertyChanged; if (phandler != null) { phandler(this, new PropertyChangedEventArgs("Dimensions")); } var handler = Loaded; if (handler != null) { handler(Pair ?? this, EventArgs.Empty); } var parent = image.GetParent <IGridBase>(); if (parent != null) { var element = parent as FrameworkElement; if (element == null) { return; } var cell = parent as ICell; if (cell != null) { parent.PerformLayout(new Size(element.ActualWidth, cell.MinHeight), new Size(element.ActualWidth, cell.MaxHeight)); } else { var view = parent as IGridView; if (view != null) { parent.PerformLayout(new UI.Size(view.Width, view.Height), new UI.Size(view.HorizontalScrollingEnabled ? double.PositiveInfinity : view.Width, view.VerticalScrollingEnabled ? double.PositiveInfinity : view.Height)); } } } }