我綁定的物品如下:如何在silverlight中獲取partular標籤元素的圖像?
<ScrollViewer>
<ItemsControl x:Name="UserList">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding imageurl}"
Tag="{Binding Path=id}" Width="164" Height="150"
Margin="4" Stretch="Fill"></Image>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
Code.cs:
List.Add(new StackImages { id = "1", Name="test",type="test",price ="testprice" ,imageurl = new Uri(this.BaseUri, @"Assets/acservice.png") });
List.Add(new StackImages { id = "2", imageurl = new Uri(this.BaseUri, @"Assets/brakes.png") });
List.Add(new StackImages { id = "3", imageurl = new Uri(this.BaseUri, @"Assets/carwash.png") });
List.Add(new StackImages { id = "4", imageurl = new Uri(this.BaseUri, @"Assets/oilchange.png") });
List.Add(new StackImages { id = "5", imageurl = new Uri(this.BaseUri, @"Assets/transmission.png") });
UserList.ItemsSource= List;
請告訴我如何獲得特定的標籤值時,就可以了自來水的particulat IMAGEURL?
我正在添加名稱,類型,價格值也列出。如何得到?我不綁定這些元素在UI.check我的編輯代碼。 – user1237131