If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

DownloadAnyone wishing to use this code in their projects may do so, however are required to leave a post on this thread stating that they are using this.
A simple "I am using this in my project" will suffice.

DO NOT MIRRORDO NOT LINK DIRECTLY TO THIS FILE - LINK TO THIS POST INSTEADDO NOT RE-DISTRIBUTE THIS SOURCE CODE PARTLY OR IN ITS ENTIRETY

This project was designed to provide a simple way to add data to a list that could be filtered and sorted, with ease... but (as with most of my projects) this quickly grew to support lots of other features such as full LINQ filtering, a datagrid view that supports UIEditors, filtering plugins, a BindingNavigator that has filtering options and more!

DonationsDonate Here - and be sure to put "i00 BindingList", your user name (or other alias), and if you want the amount/username disclosed in the description field

Features

BindingListView

Allows easy filtering

Allows easy sorting

Supports LINQ filtering

DataGridView

UI Type Editor drawing on cells

UI Type Editor support for cell editing

Inbuilt column header menus for sorting and filtering options

Data filtering plugins

Highlighting of filtered text

Faster than the standard DGV

Images scale to fit cells

Images can be selected by double clicking on an image cell

Lists and allows Enum options to be selected with ease

BindingNavigatorWithFilter

Adds filtering fields to the standard BindingNavigator

Implementation

To implement i00 BindingList into your project, first either:

Add the i00BindingList project to your solution and reference it (recommended)

Reference the i00BindingList.exe file that is output from this project

or you can bring all of *.vb files in the "i00BindingList" folder (from the zip) directly into your own project

Creating a Binding List
The Binding List can be created and filled just like any List(Of T):

vb Code:

'Create a i00BindingList.BindingListView of the required object... in this case "Person"

Dim blPersons AsNew i00BindingList.BindingListView(Of Person)

'... and to fill it:

Dim Person asNew Person()

'fill person details here

blPersons.Add(Person)

Filtering a Binding List
The Binding List can be filtered by taking advantage of i00BindingList.BindingListView.Filter property. The i00BindingList filters are in LINQ and support calls to functions from within your project itself. For example the following will filter our list to show all of the people born in 1982:

vb Code:

blPersons.Filter = "Year([DOB]) = 1982"

To access a Public Shared Function (in this case PeopleFunctions.IsInFootballTeam()) in your project you can do so by going:

Note: that while using filtering [Me], and other fields must be in square brackets.

When filtering the Binding List the FilterChanged event is called.

Binding List Binding
The Binding List exposes a BindingSource Property that can be used as a DataSource for DataGridViews, or as a BindingSource for the BindingNavigator.

The DataGridView
The i00BindingList.DataGridView inherits from DataGridView and can be used on custom data sources to allow support for UIEditors. UIEditors are part of the Net Framework and allow custom editors for items in the i00 DataGridView automatically as long as the AllowUIEditorCells and DrawUIEditorCells properties of the grid are set to true.

Filtering Plugins for the the DataGridView
If a i00BindingList.DataGridView is bound to a i00BindingList.BindingListView it will automatically allow filtering from the header based on each column's data type. These can be extended to provided advanced filtering via plugins (as pictured below)

Filter plugins are classes that implement i00BindingList.Plugins.iFilterPlugin; they automatically get picked up and allow the addition of extra filters based on each fields data type. Projects require no reference to the plugins (if they are in external files), however you will need to place them in the applications path.

The download project includes three filters ColorFilter (in the i00BindingList project), DateFilter and RecentDateTimeFilter (in the Test project).

Below is a list of implements and what they are used for after implementing iFilterPlugin:

ReadOnly Property DataTypes() As System.Type() - This should be set to return the data types (in an array) that we will be using this filter on.

ReadOnly Property Dispaly() As i00BindingList.Plugins.DisplayMethods - Sets when this filter will be displayed, options are DefaultHide, Always, DefaultShow

Sub LoadFromFilter(ByVal Filter As i00BindingList.AdvancedBindingSource.BasicFilterBase) - This is called when existing filter data (BasicFilterBase) is loaded and should update the controls in MenuItems accordingly.

Function MenuItems() As System.Collections.Generic.List(Of System.Windows.Forms.ToolStripItem) - Sets the list of controls that will be loaded into the menu for this filter.

Event UpdateFilter(ByVal sender As Object, ByVal e As i00BindingList.Plugins.UpdateFilterPluginEventArgs) - This should be raised when your controls cause the filter to be updated.

Below is an example of an iFilterPlugin that is used to filter a date range:

vb Code:

Public Class DateFilter

Implements i00BindingList.Plugins.iFilterPlugin

#Region "Controls"

'This is a Series of controls that will be available through the DataGridView's filter menu

'This is the check box that when checked filters the dates as selected by the MonthCalendar,

'This exists as the MonthCalendar has no way to have NO date selected...

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.