Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8312519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:11:33+00:00 2026-06-08T20:11:33+00:00

I am not aware if there is any callback to Listview creation so that

  • 0

I am not aware if there is any “callback” to Listview creation so that i can display very specific type of data from the List i have.
What i know is that only Complete List can be bound to the ListView, but how can i put some checking to it like its done in iOS by the help of Datasource Delegate.

Anyone ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:11:34+00:00Added an answer on June 8, 2026 at 8:11 pm

    Filtering and grouping has traditionally be done with CollectionViewSource. Unfortunately, CollectionViewSource no longer has the Filter event or the GroupDescriptions property. It may seem like filtering and grouping are unsupported, but both can still be achieved using LINQ.

    In your Xaml, add a CollectionViewSource in the Resources section of your page. Make sure IsSourceGrouped is set to true:

    <common:LayoutAwarePage.Resources>
    
        <!--
            Collection of grouped items displayed by this page, bound to a subset
            of the complete item list because items in groups cannot be virtualized
        -->
        <CollectionViewSource x:Name="GroupsCV" Source="{Binding Groups}" IsSourceGrouped="True" />
    
    </common:LayoutAwarePage.Resources>
    

    Now, the CollectionViewSource (GroupsCV) should be set as the ItemsSource for your GridView:

    <GridView ItemsSource="{Binding Source={StaticResource GroupsCV}}" />
    

    Notice that CollectionViewSource is bound to a property called Groups. This property is part of my ViewModel. The value returned by the Groups property will be the result of a LINQ query. This confused me at first because I didn’t know what type the property should return. I settled on an enumerable grouping of comparable items. This pretty much works with any LINQ query of any type.

    So, in your ViewModel (or whatever your DataContext is) add the following property:

    private IEnumerable<IGrouping<IComparable, TItem>> groups;
    public IEnumerable<IGrouping<IComparable, TItem>> Groups
    {
        get { return groups; }
        set { SetProperty(ref groups, value); }
    }
    

    Now, whenever you want to change the grouping or the filter, just set the Groups property equal to a LINQ query like so:

    Groups = from i in musicItems
                group i by i.Genre into g
                orderby g.Key
                select g;
    

    LINQ does great with known property names, but what about letting the user pick from a list of property names and dynamically grouping by that property? Well, the only requirement for LYNQ to be able to create a group is that whatever you pass it must implement IComparable.

    Here’s a little extension method that takes the name of a property as a string and returns an IComparable:

    static public IComparable GetComparableValue<T>(this T item, string propName) where T : class
    {
        return (IComparable)typeof(T).GetTypeInfo().GetDeclaredProperty(propName).GetValue(item, null);
    }
    

    With that in place, you can do a dynamic query by property name like this:

    string groupByPropertyName = "Artist";
    
    Groups = from i in musicItems
    group i by i.GetComparableValue(groupByPropertyName) into g
    orderby g.Key
    select g;
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am aware that MD5 hashes are not advisable for security any more but
This question is not language-aware. I wanna know how can I recognize a returning
I am not aware of any self-improving compiler, but then again I am not
I'm not aware of how to align the values of cells in JTable. For
NOTE: sorry as this is not a programming question but i am not aware
I am going to develop my first application (4 members team).I am not aware
Its a simple question, but I'm not aware of the answer and I couldn't
Some of people recommend the factory pattern in java. I am not aware of
I created drop down list using java. But i am not aware of creating
I know SysCache uses ASP caching under the hood, but since I'm not aware

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.