开发者

How do I set a dynamic image in WP7 LongListSelector in GroupHeaderTemplate?

开发者 https://www.devze.com 2023-02-03 15:58 出处:网络
I am using the L开发者_如何学JAVAongListSelector from the Silverlight for Windows Phone Toolkit.

I am using the L开发者_如何学JAVAongListSelector from the Silverlight for Windows Phone Toolkit.

For each group I would like to show a small group related icon, in the group header.

Group A Item 1 Item 2 Item 3

Each of the items have the same key, and are grouping correctly. And each item has the same image. But when I change my GroupHeaderTemplate from the key to something else. It doesn't seem to handle this correctly.


Typically you see examples that use a "Group" object which is based on the IGrouping<TKey, T> style object which implements IEnumberable and has a single Key property.

However there is no reason why your group object can't also have a whole range of other properties like "Name" and "ImageSource" whatever that you will be able to bind in the group item templates.


Take a look @ these two articles for insights on LongListSelector

  1. WP7 LongListSelector in depth | Part1: Visual structure and API
  2. WP7 LongListSelector in depth | Part2: Data binding scenarios


Can you show us some more information with regards to your source data and the XAMl that you're using. It sounds like you need to expose a path to the image you want for each group and then bind the Image element in the GroupHeaderTemplate to that property.

0

精彩评论

暂无评论...
验证码 换一张
取 消