How do I stop cropping of a transformed (scaled) image in a grid (silverlight)


How do I stop cropping of a transformed (scaled) image in a grid (silverlight)



I have a grid with an image in it. Initially, the image is larger than the grid, so it gets cropped which is fine, but if I apply a scaling transform to causing the image to shrink, the portion that was initally cropped remains cropped, but I want it displayed now, because it would fit in the grid.

I concidered putting my image in a canvas, but I want it centered vertically and horizontally, which is giving me trouble, so I switched to a grid.




Should the Silverlight root tag be UserControl or Canvas?

1:



How to open a zip file in a CD from silverlight control in Silverlight 2.0 Application?
Setting the Stretch property will specify how the image is displayed in the grid cell.


Silverlight 2 ListBox with a custom panel won't respect size from ArrangeOverride
.
How do you disable a node in the Silverlight Treeview?
It should default to Uniform which sounds like what you require however from your description you may either have it set to "Fill", which will fill the cell resulting in cropping, "None" showing it as the original or have specified the image width or height (this may override the Stretch)..
Silverlight - Stop highlights on a listbox
<Image Grid.Column="1" Stretch="Uniform" Source="sample.jpg"  /> 
Setting it to Uniform (or leaving out the Stretch property) and not specifying the width or height will mean it will resize to the maximum possible with out being cropped from either direction.


Can row or column definitions autosize to the dimensions of their contents
As it is still in the grid it will also centre the image.


How would you justify text in Silverlight?
A scale transform should not be required as the Stretch property will deal with this..
Silverlight - Getting the Domain Information



72 out of 100 based on 72 user ratings 222 reviews

@