I am completely confused. I’ve tried to use DecodePixelWidth property but get error: “The property ‘DecodePixelWidth’ was not found in type ‘BitmapImage'”
Then I’ve tried to compile simple program with code from MSDN page:
<Grid x:Name="LayoutRoot">
<Image Width="200">
<Image.Source>
<BitmapImage DecodePixelWidth="200" UriSource="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg" />
</Image.Source>
</Image>
</Grid>
But this doesn’t worked either. Googling gave me nothing. In C# I got same error.
Update. Using silverlight 4.0.
The
DecodePixelWidthandDecodePixelHeightproperties are not available for Silverlight, as you can see in the MSDN Silverlight documentation for BitmapImage.PixelWidthandPixelHeightare available, but only as getter properties.