Reputation: 303
i want to append the image url to image controller in grid view .
but image is not properly fitted to grid view cell. so please any one help me to how to do this.
MY CODE:
<GridView x:Name="listviewfreecredits" Margin="0,-1,0.643,10" Height="521" IsItemClickEnabled="True" ItemClick="listviewfreecredits_ItemClick" >
<GridView.ItemTemplate>
<DataTemplate>
<Grid Margin="10,0,0,0" >
<Border BorderBrush="Black" BorderThickness="2" Margin="0,5,0,5">
[![enter image description here][1]][1]
<Image Source="{Binding DealImage}" Stretch="None" Width="180" Height="245" Margin="0,5,0,5" />
</Border>
<TextBlock Text="{Binding DealID}" Visibility="Collapsed"></TextBlock>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
codeview:
JObject jobj = JObject.Parse(result);
JArray jarr = (JArray)jobj["Deals"];
if (jarr != null)
{
for (int i = 0; i < jarr.Count; i++)
{
string DealImage = (string)jarr[i]["DealImage"];
freecredit obj = new freecredit();
obj.DealImage = Url.imgurl + DealImage;
this.listviewfreecredits.Items.Add(obj);
}
}
in the above screenshot in girdview cell image is not properly fitted.(image was cutting).how to minimize image.please help me.
EDIT:
finally I got a solution.Just I removed Strech=none" and replaced with Stretch="Uniform".
Upvotes: 1
Views: 46
Reputation: 16361
Just remove Stretch="None"
or replace it with Stretch="UniformToFill"
on the Image
depending on how you want it cropped.
Upvotes: 2