Reputation: 8172
I need an instance of System.Windows.Controls.Control which displays an image. But all i have is an imagesource.
I can use
var image = new Image();
image.Source = imageSource;
but, besides Image is in the Controls namespace, it is itself not derived from Control.
Is there an easy way to get the Imagesource programmatically into a control?
Upvotes: 1
Views: 134
Reputation: 11252
You could wrap it in a ContentControl.
ContentControl cc = new ContentControl();
cc.Content = image;
But I'm really curious why you need a Control.
Upvotes: 1