Reputation: 43
<Image Grid.Row="0" Stretch="Fill" Width="220" Height="220" Source="{Binding ElementName=defectsList,Path=SelectedItem.WidgetImage, Converter={converters:StringToImageSourceConverter}}">
<Image.Clip>
<RectangleGeometry Rect="0 0 50 50">
</RectangleGeometry>
</Image.Clip>
</Image>
Here, my expectation is that the image should be cut 50X50 and must be stretched to 220 X 220 and be displayed. But it is being displayed 50 X 50 leaving the remaining space blank.
Can someone help me here?
Upvotes: 0
Views: 1012
Reputation: 169170
If you only want to display a portion of the Image
, you could use a CroppedBitmap
:
<Image Width="220" Height="220">
<Image.Source>
<CroppedBitmap Source="{Binding ElementName=defectsList,Path=SelectedItem.WidgetImage, Converter={converters:StringToImageSourceConverter}}" SourceRect="0 0 50 50"/>
</Image.Source>
</Image>
Upvotes: 1