简体   繁体   English

BitmapSource到用于FixedDocument的UI元素?

[英]BitmapSource to UI Element for FixedDocument?

I have the following in a WPF application: 我在WPF应用程序中具有以下内容:

  1. Create a stackpanel 创建一个堆栈面板
  2. Create a bitmapsource from the stackpanel 从堆栈面板创建位图源
  3. Create a FixedDocument 创建一个FixedDocument

So, I'm trying to get from step 2 to step 3. FixedDocuments only accept UIElement objects for Children.Add. 因此,我尝试从步骤2转到步骤3。FixedDocuments仅接受Children.Add的UIElement对象。 Is there a way to get from a bitmapsource to a UIElement (or some other object) that will be accepted by a FixedDocuemnt? 有没有一种方法可以从位图源获取到FixedDocumentuemnt可以接受的UIElement(或其他对象)? 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. 是的,我意识到Stackpanel是UIElement,可以将其添加到文档中,但我更喜欢将其添加为图像。

I believe you are looking for System.Windows.Controls.Image . 我相信您正在寻找System.Windows.Controls.Image Given BitmapSource bs 给定BitmapSource bs

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

should do the trick to get from 2. to 3. 应该把技巧从2提高到3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM