{"id":15036299,"url":"https://github.com/geomatics-io/bindinglistview","last_synced_at":"2026-03-17T01:41:01.759Z","repository":{"id":144188700,"uuid":"83145569","full_name":"geomatics-io/BindingListView","owner":"geomatics-io","description":"Sort, filter and aggregate lists of business objects without all the boring code! This library provides a powerful \"view\" approach to data binding .NET objects to user interface controls.","archived":false,"fork":false,"pushed_at":"2022-01-07T12:17:29.000Z","size":28940,"stargazers_count":27,"open_issues_count":3,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-14T16:51:09.814Z","etag":null,"topics":["csharp","csharp-library","datagridview","dotnet","filter","sort","winforms"],"latest_commit_sha":null,"homepage":"http://blw.sourceforge.net/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geomatics-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-25T16:35:18.000Z","updated_at":"2025-06-06T15:10:23.000Z","dependencies_parsed_at":"2023-04-05T06:32:29.348Z","dependency_job_id":null,"html_url":"https://github.com/geomatics-io/BindingListView","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/geomatics-io/BindingListView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geomatics-io%2FBindingListView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geomatics-io%2FBindingListView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geomatics-io%2FBindingListView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geomatics-io%2FBindingListView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geomatics-io","download_url":"https://codeload.github.com/geomatics-io/BindingListView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geomatics-io%2FBindingListView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265554781,"owners_count":23787279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","csharp-library","datagridview","dotnet","filter","sort","winforms"],"created_at":"2024-09-24T20:30:44.738Z","updated_at":"2026-03-17T01:41:01.730Z","avatar_url":"https://github.com/geomatics-io.png","language":"C#","readme":"# BindingListView #\n2006 [Andrew Davies](http://aboutcode.net/) created an excellent little class on [SourceForge](http://blw.sourceforge.net/) called `BindingListView\u003cT\u003e` which essentially allows you to bind a collection to a `DataGridView` while supporting sorting and filtering. Binding a `DataGridView` to a normal `List\u003cT\u003e` does not support sorting and filtering, as the proper interfaces are not implemented by `List\u003cT\u003e`.\n\nThe class works great. However, it would have been awesome if one could iterate through the collection using LINQ. **This fork updates BindingListView to .NET 4.0 and enables LINQ functionality based on an answer from [Rick Sladkey](http://stackoverflow.com/users/553613/rick-sladkey) on [Stack Overflow](http://stackoverflow.com/questions/6256559/enabling-linq-for-bindinglistviewt).**\n\n[![Build status](https://ci.appveyor.com/api/projects/status/5ue3lyncs81nawg4?svg=true)](https://ci.appveyor.com/project/geomatics/bindinglistview)\n[![NuGet version](https://badge.fury.io/nu/Geomatics.IO.BindingListView.svg)](https://badge.fury.io/nu/Geomatics.IO.BindingListView)\n\n## Introduction\n\n[![BindingListView Demo](https://github.com/geomatics-io/BindingListView/blob/master/doc/website/blw.png?raw=true)](https://github.com/geomatics-io/BindingListView/blob/master/doc/website/blw.mp4 \"BindingListView Demo\")\n\nThe BindingListView .NET library provides a type-safe, sortable, filterable, data-bindable view of one or more lists of objects. It is the business objects equivalent of using a DataView on a DataTable in ADO.NET. If you have a list of objects to display on a Windows Forms UI (e.g. in a DataGridView) and want to allow your user to sort and filter, then this is the library to use!\n\nFor a demo of what the library can do, [watch](http://blw.sourceforge.net/demo.html) the screen cast.\n\nThe source contains a few example projects demonstrating what the library can do. Check out the [SourceForge project page](http://www.sf.net/projects/blw) for forums, help, etc.\n\nThe library makes use of generics and so only works with the .NET 4.0 runtime. It should work with any .NET language: C#, VB.NET, etc.\n\n## Quick-start Guide\n\nAdd a reference to the `Equin.ApplicationFramework.BindingListView.dll` assembly. (You can download the binary or compile from source.) The classes you'll want exist in the `Equin.ApplicationFramework` namespace.\n\nHere is a very simple example of creating a view of a list of objects (in C#):\n\n```C#\nList\u003cCustomer\u003e customers = GetCustomers();\nBindingListView\u003cCustomer\u003e view = new BindingListView\u003cCustomer\u003e(customers);\ndataGridView1.DataSource = view;\n```\nThe bolded line creates a new view and passes the customers list as the \"source\" list. The view is then data bound to a DataGridView control. In the grid you can now sort by clicking on the headers. This was not possible if we had bound directly to the list object instead.\n\nYou can programatically sort the view using the ApplySort method. There are a number of overloads, the simplist of which takes a string in the form of an SQL \"order by\" clause. For example, `view.ApplySort(\"Balance DESC, Surname\")` would first sort by the Balance property (putting the highest first) and then sort by Surname (is normal ascending order). You can specify zero or more properties to sort by. With each property you can enter \"DESC\" to sort in descending order.\n\nThe restrict the items displayed by the view you can set a filter. A simple filter is a function that takes an object and returns true or false depending on if the object should appear in the view. More advanced filters can be created by creating a class that implements the IItemFilter\u003cT\u003e interface.\nThis example shows creating a filter using an anonymous method in C#.\n```C#\nview.ApplyFilter(delegate(Customer customer) { return customer.Balance \u003e 1000; });\n```\nIn VB.NET you will have to explicitly create the function.\n```C#\nview.ApplyFilter(AddressOf BalanceFilter)\n...\nFunction BalanceFilter(ByVal customer as Customer) as Boolean\n  Return customer.Balance \u003e 1000\nEnd Function\n```\nA filter will not actually remove items from the source list, they are just not visible when bound to a grid for example.\n\n## Enabling LINQ for BindingListView\u003cT\u003e ##\nYou can use LINQ directly on a `BindingListView\u003cT\u003e` instance like this:\n\n```C#\n// Create a view of the items\nitemsView = new BindingListView\u003cItem\u003e(feed.Items);\nvar descriptions = itemsView.Select(t =\u003e t.Description);\n```\n\n## An Important Detail\n\nThe BindingListView works by creating a wrapper object around each item in a source list. This is just like how a DataView contains DataRowViews, which wrap DataRow objects, in ADO.NET. The wrapper object in a BindingListView is of type `ObjectView\u003cT\u003e`. The only time you usually need to interact with an object view is when retrieving items from the view in code.\n```C#\nObjectView\u003cCustomer\u003e customerView = view[0]; // Get first item in view\nCustomer customer = customerView.Object;\n```\nThe example above uses the Object property of the ObjectView to return the original object.\nThis important detail impacts the most often when you are using a BindingSource component on a Form, as outlined in this following example.\n```C#\n// Upon a customer being selected (in a grid or listbox for example)\n// we want to do something with that object.\nprivate void customersBindingSource_PositionChanged(object sender, EventArgs e)\n{\n  // This cast will fail at runtime.\n  Customer customer = (Customer)customersBindingSource.Current\n  // The correct code is this\n  Customer customer = ((ObjectView\u003cCustomer\u003e)customersBindingSource.Current).Object\n}\n```\nBindingSource.Current is typed as just Object, so the invalid cast to Customer cannot be caught at compile time. This causes a runtime cast exception instead.\n\nCopyright © [Andrew Davey](http://blogs.warwick.ac.uk/andrewdavey) 2006\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeomatics-io%2Fbindinglistview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeomatics-io%2Fbindinglistview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeomatics-io%2Fbindinglistview/lists"}