Search code examples
silverlightimagescalestretch

How to get Stretch.Uniform scale in Silvlerlight?


Is it possible to get the scale used to stretch an image in Silverlight?

I have a image that i apply stretch.uniform on. When the browser window re-sizes, the image re-sizes as well. If it is possible to get the scale, other components can be transformed by this scale. Does anyone know how to get this?


Solution

  • The SizeChangedEventArgs (raised by the SizeChanged event) contains the members NewSize and PreviousSize. A little division and you're good to go.