简体   繁体   中英

Given the ItemClick event on a GridView, how do I know the group that was clicked?

I have a GridView that displays grouped items (similar to the default project on Win8 store apps).

The difference is that each group may contain the same items as others.

I need to know, for the item, which group it was clicked in.

[Edit: Removed "item was clicked"]

I know how work around the issue by walking the visual tree (and not using the ItemClick event) - but I want to know if there's a standard way for doing that.

Are you using the default SampleDataSource class? If you are, in the ItemView_ItemClick event, you can get the ID for the group using the following code

        var groupId = ((SampleDataItem)e.ClickedItem).Group;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM