private void CreateImage(bool isGif) { if (isGif) { if (this._gifAnimation == null) { this._gifAnimation = new GifAnimation(); this._gifAnimation.Stretch = this.Stretch; this._gifAnimation.StretchDirection = this.StretchDirection; this.AddChild(this._gifAnimation); } } else if (this._image == null) { this._image = new Image(); if (this.StretchWithStatic != Stretch.None) { this._image.Stretch = this.StretchWithStatic; } else { this._image.Stretch = this.Stretch; } this._image.StretchDirection = this.StretchDirection; this.AddChild(this._image); } }
private void ImageEx_Unloaded(object sender, RoutedEventArgs e) { base.Unloaded -= new RoutedEventHandler(this.ImageEx_Unloaded); base.MouseLeftButtonUp -= new MouseButtonEventHandler(this.ImageEx_MouseLeftButtonUp); base.MouseLeftButtonDown -= new MouseButtonEventHandler(this.ImageEx_MouseLeftButtonDown); if (this._gifAnimation != null) { this._gifAnimation.Destroy(); this._gifAnimation = null; } }
private void DeletePreviousImage() { if (this._image != null) { base.RemoveLogicalChild(this._image); base.Content = null; this._image = null; } if (this._gifAnimation != null) { base.RemoveLogicalChild(this._gifAnimation); base.Content = null; this._gifAnimation.Destroy(); this._gifAnimation = null; } if (base.Content != null) { base.RemoveLogicalChild(base.Content); base.Content = null; } }