C# listpicker wp7中未显示图像
我陷入了困境。我想在listpicker wp7中绑定一个图像和文本数据。但当我将图像和文本绑定到listpicker时,只有文本绑定。图像不绑定 这是我的密码:C# listpicker wp7中未显示图像,c#,windows-phone-7,windows-phone,C#,Windows Phone 7,Windows Phone,我陷入了困境。我想在listpicker wp7中绑定一个图像和文本数据。但当我将图像和文本绑定到listpicker时,只有文本绑定。图像不绑定 这是我的密码: public void loadvehicaltype() { List<vehical> listofvehical = new List<vehical>(); listofvehical.Add(new vehical() { CarTyp
public void loadvehicaltype()
{
List<vehical> listofvehical = new List<vehical>();
listofvehical.Add(new vehical() { CarType= "Any Vehical" });
listofvehical.Add(new vehical() { CarType = "test1", carImage = "Images/car_Images/test_yellow.png" });
listofvehical.Add(new vehical() { CarType = "test2" });
listofvehical.Add(new vehical() { CarType = "Any Vehical" });
this.listPickerVehicalType.ItemsSource = listofvehical;
}
这里是XAML:
<toolkit:ListPicker x:Name="listPickerVehicalType" Tap="listPickerVehicalType_Tap" SelectionMode="Single" ItemTemplate="{StaticResource ListPickerItemTemplate}" FullModeItemTemplate="{StaticResource ListPickerFullModeItemTemplate}" FullModeHeader="Items" CacheMode="BitmapCache"/>
及
请帮我解决这个问题。我搜索了这个问题,但没有找到任何结果,这是因为您的图像的“构建操作”设置为“资源”,这是默认设置。您可以将其切换到内容: 右键单击图像并将其构建操作设置为内容
1你能确认图片是有效的吗:将url设置为internet上可用的图片吗http://... . 2设置图像的高度和宽度control@Ku6opr:谢谢你的回复。你所说的互联网图像的Url是什么意思?我设置了图像的高度和宽度,但响应相同的公共图像url
<toolkit:ListPicker x:Name="listPickerVehicalType" Tap="listPickerVehicalType_Tap" SelectionMode="Single" ItemTemplate="{StaticResource ListPickerItemTemplate}" FullModeItemTemplate="{StaticResource ListPickerFullModeItemTemplate}" FullModeHeader="Items" CacheMode="BitmapCache"/>
<DataTemplate x:Name="ListPickerItemTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CarType}" Margin="10 0 0 0"/>
<!--<Image Source="{Binding carImage}" Margin="10,0,0,0" Stretch="None" />-->
</StackPanel>
</DataTemplate>
<DataTemplate x:Name="ListPickerFullModeItemTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CarType}" Margin="10,0,0,0"/>
<Image Source="{Binding carImage}" />
</StackPanel>
</DataTemplate>