[英]BitmapSource to UI Element for FixedDocument?
I have the following in a WPF application: 我在WPF应用程序中具有以下内容:
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.