我想知道在人员应用程序中创建列表的最佳方法是什么,其中组按字母排序。我的第一次尝试工作......我基本上使用了GridView,我使用模板选择器为字母A,B,C等使用了不同的模板,并为实际项目使用了不同的模板,但我我遇到了问题,因为标题被认为是"项目"。他们正在响应鼠标翻转和点击事件,我想我可以以某种方式更深入地进入GridView 模板,但我真的觉得我可能会以错误的方式进行此操作。任何指针都会非常感激。
I am wondering what is the best way to make a list like the in the people application where groups are sorted by letter. My first attempt worked... I basically used an GridView and I used a template selector to use adifferenttemplate for the letters A, B, C etc and adifferenttemplate for the actual items but I am running into issues because the titles are considered "items". They are responding to mouse over and click events and I suppose I could somehow going deeper into the GridView template but I really feel like I may be going about this the wrong way. Any pointers would be much appreciated.
推荐答案
在这种情况下,你可以指定一个ItemContainerStyleSelector并返回你所有的"索引项"。 (字母)一种样式,它将相应GridViewItem的IsHitTistVisibleProperty设置为false。
In that case you can specify an ItemContainerStyleSelector and returning for all of your "index items" (the letters) a style which sets the IsHitTistVisibleProperty of the according GridViewItem to false.
例如。
public class IndexStyleSelector : StyleSelector { public Style IndexStyle { get; set; } public Style ItemStyle { get; set; } protected override Style SelectStyleCore( object item, DependencyObject container ) { Index index = item as Index; return index != null ? IndexStyle : ItemStyle; } }
更多推荐
按字母创建分组列表....就像在人员应用程序中一样
发布评论