• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 490
  • Last Modified:

C# 4.0 WPF Datagrid Filtering


I have an object (please see code below) which contains a list. This list is currently binded to a datagrid in my WPF application.

What I would like to do is to be able to display only some of the results from my list based on the field Status. Can someone please send me some example code of how to do this?

C# Code
class OrderBlocks
   public string setting;
   public List<Order> Orders;

class Order
  public double Amount;
  public int Name;
  public bool Status;

Open in new window


<DataGrid DataContext="{Binding OrderBlock}"
                      ItemsSource="{Binding Orders}"/>

Open in new window

1 Solution
Just make sure the "orders" contains the filtered list of objects before the datagrid gets its context.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now