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 8970485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:44:01+00:00 2026-06-15T17:44:01+00:00

I am working with a WPF control that I created and I am trying

  • 0

I am working with a WPF control that I created and I am trying to only show certain rows of my list by values of a property. An example is the following, I have a User class that holds a property of Active. How do I tell the .xaml that the list should only show the people that are Active?

Right now I am basically using linq to generate a new list and hand it to the listview based on what I want. However, I would rather just hand the ListView my entire list and let it do the work for me.

Here is my ListView code.

<ListView ItemsSource="{Binding}" DataContext="{Binding }" >
     <ListView.View>
          <GridView>
               <GridViewColumn>
                    <GridViewColumn.CellTemplate>
                         <DataTemplate>
                              <StackPanel>
                                   <TextBlock Text="{Binding Index}"/>
                                   <TextBlock Text=". " />
                                   <TextBlock Text="{Binding FirstName}" />
                                   <TextBlock Text="{Binding LastName}" />
                              </StackPanel>
                         </DataTemplate>
                    </GridViewColumn.CellTemplate>
               </GridViewColumn>
          </GridView>
     </ListView.View>
</ListView>
  • 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-15T17:44:01+00:00Added an answer on June 15, 2026 at 5:44 pm

    You’ll need some code behind to add a filter:

    See: WPF filtering

    ICollectionView view = CollectionViewSource.GetDefaultView(lstMovies.ItemsSource);  
    view.Filter = null;  
    view.Filter = new Predicate<object>(FilterMovieItem);  
    
    
    private bool FilterMovieItem(object obj)  
    {  
        MovieItem item = obj as MovieItem;  
        if (item == null) return false;  
    
        string textFilter = txtFilter.Text;  
    
        if (textFilter.Trim().Length == 0) return true; // the filter is empty - pass all items  
    
        // apply the filter  
        if (item.MovieName.ToLower().Contains(textFilter.ToLower())) return true;  
        return false;  
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a WPF custom control. The control has a property that is
I am working on a countdown control for a WPF application. The following xaml
For you wpf silverlight people who are working with source control that allows merging.
I've been working on a WPF control for a few weeks now that contains
I am working on WPF, I am designing a control that contains a datagrid,
I created a UserControl in WPF. This user control has several text boxes that
I am currently working within a WPF user control (the root element of my
Im working in WPF and I am trying to change the image of a
I'm working with WPF and EF. I'm using a Datagrid to show information. In
I'm trying to create a Venn diagram control for an application I'm working on

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.