Use the igrouping interface for Windows Phone longlistselector

Source: Internet
Author: User

Longlistselector is special. It requires that the data source at least implement the ienumerable <t> interface, and then each element in it must implement the ienumerable <t> interface.

Considering that you need to provide the group title, it would be better if you can use the LINQ statement to query, because the returned object implements the igrouping <tkey, telement> interface.

This interface inherits the ienumerable <t> interface. however, you cannot directly query the returned group objects by using the LINQ group, because the data binding of Silverlight uses the type. getproperty () to get the specified property. This method cannot get the interface property of the display implementation. the tkey attribute of the group object is implemented by the igrouping <tkey, telement> interface through display. Therefore, it must be as follows:

Public class grouping <tkey, telement>: List <telement> {public grouping (igrouping <tkey, telement> G): Base (g) {key = G. key ;}public tkey {Get; Set ;}}

From B in Set

Select new grouping <key, element> (g );

In this way, you can use the LINQ statement.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.