Click here to Skip to main content
11,805,604 members (65,087 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# WPF
how to get the control inside image in wpf
Posted 10-Feb-13 0:14am
Edited 10-Feb-13 1:05am
Joezer BH38.3K
Sergey Alexandrovich Kryukov at 10-Feb-13 8:52am
What is that supposed to mean?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The source of the image can be used like:
ImageSource imageSource = new BitmapImage(new Uri("C:\\FileName.gif"));
image1.Source = imageSource;

The following example shows how to render an image 200 pixels wide using code:
// Create Image Element
Image myImage = new Image();
myImage.Width = 200;
// Create source
BitmapImage myBitmapImage = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg");
// To save significant application memory, set the DecodePixelWidth or  
// DecodePixelHeight of the BitmapImage value of the image source to the desired 
// height or width of the rendered image. If you don't do this, the application will 
// cache the image as though it were rendered as its normal size rather then just 
// the size that is displayed.
// Note: In order to preserve aspect ratio, set DecodePixelWidth
// or DecodePixelHeight but not both.
myBitmapImage.DecodePixelWidth = 200;
//set image source
myImage.Source = myBitmapImage;

Sergey Alexandrovich Kryukov at 10-Feb-13 8:54am
I'm afraid this is not an answer, and I don't think this question needs answer as it sounds like a gibberish to me; what is "control inside image"?!
(I did not vote this time.)
Edo Tzumer at 10-Feb-13 9:37am
Well, you're right of course.
The guy definitely has SOMETHING in mind.
Either you ditch him by saying that this kind of "question" is unaccepted, or try to help him out with expressing what he wants\needs\misses etc
I guess you are more of an A type than a B.
[perhaps everyone is a B type until they realize its impossible to solve the world's undefined problems...]
Sergey Alexandrovich Kryukov at 10-Feb-13 9:44am
I'm none of the types you described...
But without "expressing" the answer can only confuse.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 3,265
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 10 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100