按字母创建分组列表....就像在人员应用程序中一样

编程入门 行业动态 更新时间:2024-10-28 06:21:47
本文介绍了按字母创建分组列表....就像在人员应用程序中一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道在人员应用程序中创建列表的最佳方法是什么,其中组按字母排序。我的第一次尝试工作......我基本上使用了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; } }

更多推荐

按字母创建分组列表....就像在人员应用程序中一样

本文发布于:2023-10-26 17:05:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:就像   应用程序   字母   人员   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!