WPF programmed in C#: I have a program where the user can click a box and a dialog box pops up and they can select any image. Whatever image they select will appear in the box. I want to be able to display the width and height of the image, because if the image they selects is small, it'll resize to fit the box. But I want to display the actual width and height of the image they selected. How can i do that?
A:
You actually kind of answered your own question. There are two dependency properties that you can use: ActualWidth and ActualHeight.
This will give you the size that the picture is using on the screen, not what is currently set, which is what Width and Height give you.
Also, these dependency properties are useable by any FrameworkElement I believe.
Joseph
2009-08-11 15:51:19
I think Jake is referring to the width and height of the image itself, not of the `Image` control...
Thomas Levesque
2009-08-11 16:08:00
@Thomas Oh you're probably right. I'll leave my answer in case someone finds this looking for information on the control
Joseph
2009-08-11 16:32:44