开发者

WPF/Silverlight question: how to add a A-Z list items viewer?

开发者 https://www.devze.com 2023-01-30 10:15 出处:网络
I am new to WPF/Silverlight, and one thing I\'d like to do in an app is to display a bunch of items in a list box, but have it be sortable/accessible via an A-Z picker, similar to what you have on the

I am new to WPF/Silverlight, and one thing I'd like to do in an app is to display a bunch of items in a list box, but have it be sortable/accessible via an A-Z picker, similar to what you have on the iPhone's Contact app.

eg: Clicking A takes you to the items grouped as beginning w/ A, etc. For a list w/ a lot of items in it, it's quite handy to jump ahead to exactly where you know a record should be.

Is there a 3rd party control for this? (yay less work!) Is there a free control for this? (yay lazy, and cheap!) Any pointers on the basic out of the box layout items/controls I'd put together to get it started were I to roll my own?

I'm experienced 开发者_JAVA技巧w/ C#/.NET, just new to WPF/Silverlight, Expression Blend.

Thanks, and I'll take my answer the air.


I'll assume that you have an ObservableCollection< Item> called OC for all items.

all what you need is to create another list depending on the letter and bind it to the listbox like.

char K='A';
List<Item> ListLetter = (from Item C in OC
where C.Name.StartWith(K)
select C).ToList();
0

精彩评论

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