Unknown Coder
Unknown Coder

Reputation: 6731

BitmapSource to UI Element for FixedDocument?

I have the following in a WPF application:

  1. Create a stackpanel
  2. Create a bitmapsource from the stackpanel
  3. Create a FixedDocument

So, I'm trying to get from step 2 to step 3. FixedDocuments only accept UIElement objects for Children.Add. Is there a way to get from a bitmapsource to a UIElement (or some other object) that will be accepted by a FixedDocuemnt? Yes, I realize that a Stackpanel is a UIElement and I could add that to my document but I prefer to add it as an image.

Upvotes: 0

Views: 1098

Answers (1)

Mike
Mike

Reputation: 940

I believe you are looking for System.Windows.Controls.Image. Given BitmapSource bs

Image anImage = new Image();
anImage.Source = bs;

should do the trick to get from 2. to 3.

Upvotes: 1

Related Questions