ObjectListView
A DataTreeListView is a TreeListView that calculates its hierarchy based on
information in the data source.
Like a , a DataTreeListView sources all its information
from a combination of and .
can be a DataTable, DataSet,
or anything that implements .
To function properly, the DataTreeListView requires:
- the table to have a column which holds a unique for the row. The name of this column must be set in .
- the table to have a column which holds id of the hierarchical parent of the row. The name of this column must be set in .
- a value which identifies which rows are the roots of the tree ().
The hierarchy structure is determined finding all the rows where the parent key is equal to . These rows
become the root objects of the hierarchy.
Like a TreeListView, the hierarchy must not contain cycles. Bad things will happen if the data is cyclic.
A TreeListView combines an expandable tree structure with list view columns.
To support tree operations, two delegates must be provided:
-
CanExpandGetter
This delegate must accept a model object and return a boolean indicating
if that model should be expandable.
-
ChildrenGetter
This delegate must accept a model object and return an IEnumerable of model
objects that will be displayed as children of the parent model. This delegate will only be called
for a model object if the CanExpandGetter has already returned true for that model.
-
ParentGetter
This delegate must accept a model object and return the parent model.
This delegate will only be called when HierarchicalCheckboxes is true OR when Reveal() is called.
The top level branches of the tree are set via the Roots property. SetObjects(), AddObjects()
and RemoveObjects() are interpreted as operations on this collection of roots.
To add new children to an existing branch, make changes to your model objects and then
call RefreshObject() on the parent.
The tree must be a directed acyclic graph -- no cycles are allowed. Put more mundanely,
each model object must appear only once in the tree. If the same model object appears in two
places in the tree, the control will become confused.
A virtual object list view operates in virtual mode, that is, it only gets model objects for
a row when it is needed. This gives it the ability to handle very large numbers of rows with
minimal resources.
A listview is not a great user interface for a large number of items. But if you've
ever wanted to have a list with 10 million items, go ahead, knock yourself out.
Virtual lists can never iterate their contents. That would defeat the whole purpose.
Animated GIFs should not be used in virtual lists. Animated GIFs require some state
information to be stored for each animation, but virtual lists specifically do not keep any state information.
In any case, you really do not want to keep state information for 10 million animations!
Although it isn't documented, .NET virtual lists cannot have checkboxes. This class codes around this limitation,
but you must use the functions provided by ObjectListView: CheckedObjects, CheckObject(), UncheckObject() and their friends.
If you use the normal check box properties (CheckedItems or CheckedIndicies), they will throw an exception, since the
list is in virtual mode, and .NET "knows" it can't handle checkboxes in virtual mode.
Due to the limits of the underlying Windows control, virtual lists do not trigger ItemCheck/ItemChecked events.
Use a CheckStatePutter instead.
To enable grouping, you must provide an implmentation of IVirtualGroups interface, via the GroupingStrategy property.
Similarly, to enable filtering on the list, your VirtualListDataSource must also implement the IFilterableDataSource interface.
An ObjectListView is a much easier to use, and much more powerful, version of the ListView.
An ObjectListView automatically populates a ListView control with information taken
from a given collection of objects. It can do this because each column is configured
to know which bit of the model object (the "aspect") it should be displaying. Columns similarly
understand how to sort the list based on their aspect, and how to construct groups
using their aspect.
Aspects are extracted by giving the name of a method to be called or a
property to be fetched. These names can be simple names or they can be dotted
to chain property access e.g. "Owner.Address.Postcode".
Aspects can also be extracted by installing a delegate.
An ObjectListView can show a "this list is empty" message when there is nothing to show in the list,
so that the user knows the control is supposed to be empty.
Right clicking on a column header should present a menu which can contain:
commands (sort, group, ungroup); filtering; and column selection. Whether these
parts of the menu appear is controlled by ShowCommandMenuOnRightClick,
ShowFilterMenuOnRightClick and SelectColumnsOnRightClick respectively.
The groups created by an ObjectListView can be configured to include other formatting
information, including a group icon, subtitle and task button. Using some undocumented
interfaces, these groups can even on virtual lists.
ObjectListView supports dragging rows to other places, including other application.
Special support is provide for drops from other ObjectListViews in the same application.
In many cases, an ObjectListView becomes a full drag source by setting to
true. Similarly, to accept drops, it is usually enough to set to true,
and then handle the and events (or the and
events, if you only want to handle drops from other ObjectListViews in your application).
For these classes to build correctly, the project must have references to these assemblies:
- System
- System.Data
- System.Design
- System.Drawing
- System.Windows.Forms (obviously)
The name of the image used when a column is sorted ascending
This image is only used on pre-XP systems. System images are used for XP and later
The name of the image used when a column is sorted descending
This image is only used on pre-XP systems. System images are used for XP and later
The name of the image used when a check box is checked
The name of the image used when a check box is unchecked
The name of the image used when a check box is Indeterminate
Tell the world when a cell is about to be edited.
Tell the world when a cell is about to finish being edited.
Tell the world when a cell is about to finish being edited.
Tell the world when a cell has finished being edited.
Create an ObjectListView
Dispose of any resources this instance has been using
Convert the given enumerable into an ArrayList as efficiently as possible
The source collection
If true, this method will always create a new
collection.
An ArrayList with the same contents as the given collection.
When we move to .NET 3.5, we can use LINQ and not need this method.
Return the count of items in the given enumerable
When we move to .NET 3.5, we can use LINQ and not need this method.
Return whether or not the given enumerable is empty. A string is regarded as
an empty collection.
True if the given collection is null or empty
When we move to .NET 3.5, we can use LINQ and not need this method.
Get the renderer to be used to draw the given cell.
The row model for the row
The column to be drawn
The renderer used for drawing a cell. Must not return null.
Is this given model object disabled?
Disable the given model object.
Disabled objects cannot be selected or activated.
Must not be null
Disable all the given model objects
Enable the given model object, so it can be selected and activated again.
Must not be null
Enable all the given model objects
Forget all disabled objects. This does not trigger a redraw or rebuild
This registry decides what control should be used to edit what cells, based
on the type of the value in the cell.
All instances of ObjectListView share the same editor registry.
Add the given model object to this control.
The model object to be displayed
See AddObjects() for more details
Add the given collection of model objects to this control.
A collection of model objects
The added objects will appear in their correct sort position, if sorting
is active (i.e. if PrimarySortColumn is not null). Otherwise, they will appear at the end of the list.
No check is performed to see if any of the objects are already in the ListView.
Null objects are silently ignored.
Resize the columns to the maximum of the header width and the data.
Set up any automatically initialized column widths (columns that
have a width of 0 or -1 will be resized to the width of their
contents or header respectively).
Obviously, this will only work once. Once it runs, the columns widths will
be changed to something else (other than 0 or -1), so it wont do anything the
second time through. Use to force all columns
to change their size.
Organise the view items into groups, based on the last sort column or the first column
if there is no last sort column
Organise the view items into groups, based on the given column
If the AlwaysGroupByColumn property is not null,
the list view items will be organisd by that column,
and the 'column' parameter will be ignored.
This method triggers sorting events: BeforeSorting and AfterSorting.
The column whose values should be used for sorting.
Organise the view items into groups, based on the given columns
What column will be used for grouping
What ordering will be used for groups
The column whose values should be used for sorting. Cannot be null
The order in which the values from column will be sorted
When the values from 'column' are equal, use the values provided by this column
How will the secondary values be sorted
This method does not trigger sorting events. Use BuildGroups() to do that
Collect and return all the variables that influence the creation of groups
Make a list of groups that should be shown according to the given parameters
The list of groups to be created
This should not change the state of the control. It is possible that the
groups created will not be used. They may simply be discarded.
Build/rebuild all the list view items in the list, preserving as much state as is possible
Build/rebuild all the list view items in the list
If this is true, the control will try to preserve the selection,
focused item, and the scroll position (see Remarks)
Use this method in situations were the contents of the list is basically the same
as previously.
Clear any cached info this list may have been using
Apply all required extended styles to our control.
Whenever .NET code sets an extended style, it erases all other extended styles
that it doesn't use. So, we have to explicit reapply the styles that we have
added.
Normally, we would override CreateParms property and update
the ExStyle member, but ListView seems to ignore all ExStyles that
it doesn't already know about. Worse, when we set the LVS_EX_HEADERINALLVIEWS
value, bad things happen (the control crashes!).
Give the listview a reasonable size of its tiles, based on the number of lines of
information that each tile is going to display.
Rebuild this list for the given view
Remove all items from this list
This method can safely be called from background threads.
Reset the memory of which URLs have been visited
Copy a text and html representation of the selected rows onto the clipboard.
Be careful when using this with virtual lists. If the user has selected
10,000,000 rows, this method will faithfully try to copy all of them to the clipboard.
From the user's point of view, your program will appear to have hung.
Copy a text and html representation of the given objects onto the clipboard.
Return a html representation of the given objects
Deselect all rows in the listview
Return the ListViewItem that appears immediately after the given item.
If the given item is null, the first item in the list will be returned.
Return null if the given item is the last item.
The item that is before the item that is returned, or null
A ListViewItem
Return the last item in the order they are shown to the user.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the n'th item (0-based) in the order they are shown to the user.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the display index of the given listviewitem index.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the ListViewItem that appears immediately before the given item.
If the given item is null, the last item in the list will be returned.
Return null if the given item is the first item.
The item that is before the item that is returned
A ListViewItem
Insert the given collection of objects before the given position
Where to insert the objects
The objects to be inserted
This operation only makes sense of non-sorted, non-grouped
lists, since any subsequent sort/group operation will rearrange
the list.
This method only works on ObjectListViews and FastObjectListViews.
Return true if the row representing the given model is selected
The model object to look for
Is the row selected
Has the given URL been visited?
The string to be consider
Has it been visited
Scroll the ListView by the given deltas.
Horizontal delta
Vertical delta
Remember that the given URL has been visited
The url to be remembered
This does not cause the control be redrawn
Move the given collection of objects to the given index.
This operation only makes sense on non-grouped ObjectListViews.
Calculate what item is under the given point?
Perform a hit test using the Windows control's SUBITEMHITTEST message.
This provides information about group hits that the standard ListView.HitTest() does not.
What is under the given point? This takes the various parts of a cell into accout, including
any custom parts that a custom renderer might use
An information block about what is under the point
Perform a hit test when the control is not owner drawn
Perform a hit test when the control is owner drawn. This hands off responsibility
to the renderer.
Pause (or unpause) all animations in the list
true to pause, false to unpause
Rebuild the columns based upon its current view and column visibility settings
Remove the given model object from the ListView
The model to be removed
See RemoveObjects() for more details
This method is thread-safe.
Remove all of the given objects from the control.
Collection of objects to be removed
Nulls and model objects that are not in the ListView are silently ignored.
This method is thread-safe.
Select all rows in the listview
Set the given image to be fixed in the bottom right of the list view.
This image will not scroll when the list view scrolls.
This method uses ListView's native ability to display a background image.
It has a few limitations:
- It doesn't work well with owner drawn mode. In owner drawn mode, each cell draws itself,
including its background, which covers the background image.
- It doesn't look very good when grid lines are enabled, since the grid lines are drawn over the image.
- It does not work at all on XP.
- Obviously, it doesn't look good when alternate row background colors are enabled.
If you can live with these limitations, native watermarks are quite neat. They are true backgrounds, not
translucent overlays like the OverlayImage uses. They also have the decided advantage over overlays in that
they work correctly even in MDI applications.
Setting this clears any background image.
The image to be drawn. If null, any existing image will be removed.
Set the given image to be background of the ListView so that it appears at the given
percentage offsets within the list.
This has the same limitations as described in . Make sure those limitations
are understood before using the method.
This is very similar to setting the property of the standard .NET ListView, except that the standard
BackgroundImage does not handle images with transparent areas properly -- it renders transparent areas as black. This
method does not have that problem.
Setting this clears any background watermark.
The image to be drawn. If null, any existing image will be removed.
The horizontal percentage where the image will be placed. 0 is absolute left, 100 is absolute right.
The vertical percentage where the image will be placed.
Set the given image to be the tiled background of the ListView.
This has the same limitations as described in and .
Make sure those limitations
are understood before using the method.
The image to be drawn. If null, any existing image will be removed.
Set the collection of objects that will be shown in this list view.
This method can safely be called from background threads.
The list is updated immediately
The objects to be displayed
Set the collection of objects that will be shown in this list view.
This method can safely be called from background threads.
The list is updated immediately
The objects to be displayed
Should the state of the list be preserved as far as is possible.
Update the given model object into the ListView. The model will be added if it doesn't already exist.
The model to be updated
See for more details
This method is thread-safe.
This method will cause the list to be resorted.
This method only works on ObjectListViews and FastObjectListViews.
Update the pre-existing models that are equal to the given objects. If any of the model doesn't
already exist in the control, they will be added.
Collection of objects to be updated/added
This method will cause the list to be resorted.
Nulls are silently ignored.
This method is thread-safe.
This method only works on ObjectListViews and FastObjectListViews.
Change any subscriptions to INotifyPropertyChanged events on our current
model objects so that we no longer listen for events on the old models
and do listen for events on the given collection.
This does nothing if UseNotifyPropertyChanged is false.
Subscribe to INotifyPropertyChanges on the given collection of objects.
Unsubscribe from INotifyPropertyChanges on the given collection of objects.
If the given collection is null, unsubscribe from all current subscriptions
Return a byte array that represents the current state of the ObjectListView, such
that the state can be restored by RestoreState()
The state of an ObjectListView includes the attributes that the user can modify:
- current view (i.e. Details, Tile, Large Icon...)
- sort column and direction
- column order
- column widths
- column visibility
It does not include selection or the scroll position.
A byte array representing the state of the ObjectListView
Restore the state of the control from the given string, which must have been
produced by SaveState()
A byte array returned from SaveState()
Returns true if the state was restored
The application is idle. Trigger a SelectionChanged event.
The application is idle. Handle the column resizing event.
Handle the BeginScroll listview notification
True if the event was completely handled
Handle the EndScroll listview notification
True if the event was completely handled
Handle the LinkClick listview notification
True if the event was completely handled
The cell tooltip control wants information about the tool tip that it should show.
Allow the HeaderControl to call back into HandleHeaderToolTipShowing without making that method public
The header tooltip control wants information about the tool tip that it should show.
Event handler for the column click event
Override the basic message pump for this control
Handle the search for item m if possible.
The m to be processed
bool to indicate if the msg has been handled
The user wants to see the context menu.
The windows m
A bool indicating if this m has been handled
We want to ignore context menu requests that are triggered by right clicks on the header
Handle the Custom draw series of notifications
The message
True if the message has been handled
Handle the underlying control being destroyed
Handle the search for item m if possible.
The m to be processed
bool to indicate if the msg has been handled
Find the first row after the given start in which the text value in the
comparison column begins with the given text. The comparison column is column 0,
unless IsSearchOnSortColumn is true, in which case the current sort column is used.
The text to be prefix matched
The index of the first row to consider
Which direction should be searched?
The index of the first row that matched, or -1
The text comparison is a case-insensitive, prefix match. The search will
search the every row until a match is found, wrapping at the end if needed.
Find the first row in the given range of rows that prefix matches the string value of the given column.
The index of the matched row, or -1
Handle the Group Info series of notifications
The message
True if the message has been handled
Handle a key down message
True if the msg has been handled
Toggle the checkedness of the selected rows
Actually, this doesn't actually toggle all rows. It toggles the first row, and
all other rows get the check state of that first row. This is actually a much
more useful behaviour.
If no rows are selected, this method does nothing.
Catch the Left Button down event.
The m to be processed
bool to indicate if the msg has been handled
Handle a left mouse down at the given hit test location
Subclasses can override this to do something unique
True if the message has been handled
Catch the Left Button up event.
The m to be processed
bool to indicate if the msg has been handled
Trigger a GroupExpandCollapse event and return true if the action was cancelled
Catch the Right Button down event.
The m to be processed
bool to indicate if the msg has been handled
Handle a left mouse down at the given hit test location
Subclasses can override this to do something unique
True if the message has been handled
Catch the Left Button double click event.
The m to be processed
bool to indicate if the msg has been handled
Handle a mouse double click at the given hit test location
Subclasses can override this to do something unique
True if the message has been handled
Catch the right Button double click event.
The m to be processed
bool to indicate if the msg has been handled
Handle a right mouse double click at the given hit test location
Subclasses can override this to do something unique
True if the message has been handled
Catch the MouseMove event.
The m to be processed
bool to indicate if the msg has been handled
Handle notifications that have been reflected back from the parent window
The m to be processed
bool to indicate if the msg has been handled
In the notification messages, we handle attempts to change the width of our columns
The m to be processed
bool to indicate if the msg has been handled
Create a ToolTipControl to manage the tooltip control used by the listview control
Update the handle used by our cell tooltip to be the tooltip used by
the underlying Windows listview control.
Handle the WM_PAINT event
Return true if the msg has been handled and nothing further should be done
Perform any steps needed before painting the control
Perform any steps needed after painting the control
Handle the window position changing.
The m to be processed
bool to indicate if the msg has been handled
The user has right clicked on the column headers. Do whatever is required
Return true if this event has been handle
Show a menu that is appropriate when the given column header is clicked.
The index of the header that was clicked. This
can be -1, indicating that the header was clicked outside of a column
Where should the menu be shown
True if a menu was displayed
Create the menu that should be displayed when the user right clicks
on the given column header.
Index of the column that was right clicked.
This can be negative, which indicates a click outside of any header.
The toolstrip that should be displayed
The user has right clicked on the column headers. Do whatever is required
Return true if this event has been handle
Show a popup menu at the given point which will allow the user to choose which columns
are visible on this listview
Where should the menu be placed
Show a popup menu at the given point which will allow the user to choose which columns
are visible on this listview
Where should the menu be placed
Gets or sets the image that will be place next to the Sort Ascending command
Gets or sets the image that will be placed next to the Sort Descending command
Append the column selection menu items to the given menu strip.
The menu to which the items will be added.
Return the menu to which the items were added
Append the column selection menu items to the given menu strip.
The menu to which the items will be added.
Return the menu to which the items were added
Create the menu items that will allow columns to be choosen and add them to the
given collection
Create a Filtering menu
Override the OnColumnReordered method to do what we want
When the column widths are changing, resize the space filling columns
When the column widths change, resize the space filling columns
When the size of the control changes, we have to resize our space filling columns.
Resize our space filling columns so they fill any unoccupied width in the control
Resize our space filling columns so they fill any unoccupied width in the control
Check all rows
Check the checkbox in the given column header
If the given columns header check box is linked to the cell check boxes,
then checkboxes in all cells will also be checked.
Mark the checkbox in the given column header as having an indeterminate value
Mark the given object as indeterminate check state
The model object to be marked indeterminate
Mark the given object as checked in the list
The model object to be checked
Mark the given objects as checked in the list
The model object to be checked
Put a check into the check box at the given cell
Put an indeterminate check into the check box at the given cell
Return true of the given object is checked
The model object whose checkedness is returned
Is the given object checked?
If the given object is not in the list, this method returns false.
Return true of the given object is indeterminately checked
The model object whose checkedness is returned
Is the given object indeterminately checked?
If the given object is not in the list, this method returns false.
Is there a check at the check box at the given cell
Get the checkedness of an object from the model. Returning null means the
model does not know and the value from the control will be used.
Record the change of checkstate for the given object in the model.
This does not update the UI -- only the model
The check state that was recorded and that should be used to update
the control.
Change the check state of the given object to be the given state.
If the given model object isn't in the list, we still try to remember
its state, in case it is referenced in the future.
True if the checkedness of the model changed
Toggle the checkedness of the given object. A checked object becomes
unchecked; an unchecked or indeterminate object becomes checked.
If the list has tristate checkboxes, the order is:
unchecked -> checked -> indeterminate -> unchecked ...
The model object to be checked
Toggle the checkbox in the header of the given column
Obviously, this is only useful if the column actually has a header checkbox.
Toggle the check at the check box of the given cell
Uncheck all rows
Mark the given object as unchecked in the list
The model object to be unchecked
Mark the given objects as unchecked in the list
The model object to be checked
Uncheck the checkbox in the given column header
Uncheck the check at the given cell
Return the column at the given index
Index of the column to be returned
An OLVColumn
Return the column at the given title.
Name of the column to be returned
An OLVColumn
Return a collection of columns that are visible to the given view.
Only Tile and Details have columns; all other views have 0 columns.
Which view are the columns being calculate for?
A list of columns
Return the number of items in the list
the number of items in the list
If a filter is installed, this will return the number of items that match the filter.
Return the item at the given index
Index of the item to be returned
An OLVListItem
Return the model object at the given index
Index of the model object to be returned
A model object
Find the item and column that are under the given co-ords
X co-ord
Y co-ord
The column under the given point
The item under the given point. Can be null.
Return the sub item at the given index/column
Index of the item to be returned
Index of the subitem to be returned
An OLVListSubItem
Scroll the listview so that the given group is at the top.
The group to be revealed
If the group is already visible, the list will still be scrolled to move
the group to the top, if that is possible.
This only works when the list is showing groups (obviously).
This does not work on virtual lists, since virtual lists don't use ListViewGroups
for grouping. Use instead.
Ensure that the given model object is visible
The model object to be revealed
Return the model object of the row that is selected or null if there is no selection or more than one selection
Model object or null
Return the model objects of the rows that are selected or an empty collection if there is no selection
ArrayList
Return the model object of the row that is checked or null if no row is checked
or more than one row is checked
Model object or null
Use CheckedObject property instead of this method
Get the collection of model objects that are checked.
Use CheckedObjects property instead of this method
Find the given model object within the listview and return its index
The model object to be found
The index of the object. -1 means the object was not present
Rebuild the given ListViewItem with the data from its associated model.
This method does not resort or regroup the view. It simply updates
the displayed data of the given item
Rebuild the data on the row that is showing the given object.
This method does not resort or regroup the view.
The given object is *not* used as the source of data for the rebuild.
It is only used to locate the matching model in the collection,
then that matching model is used as the data source. This distinction is
only important in model classes that have overridden the Equals() method.
If you want the given model object to replace the pre-existing model,
use .
Update the rows that are showing the given objects
This method does not resort or regroup the view.
This method can safely be called from background threads.
Update the rows that are selected
This method does not resort or regroup the view.
Select the row that is displaying the given model object, in addition to any current selection.
The object to be selected
Use the property to deselect all other rows
Select the row that is displaying the given model object, in addition to any current selection.
The object to be selected
Should the object be focused as well?
Use the property to deselect all other rows
Select the rows that is displaying any of the given model object. All other rows are deselected.
A collection of model objects
Freeze the listview so that it no longer updates itself.
Freeze()/Unfreeze() calls nest correctly
Unfreeze the listview. If this call is the outermost Unfreeze(),
the contents of the listview will be rebuilt.
Freeze()/Unfreeze() calls nest correctly
Do the actual work required when the listview is frozen
Do the actual work required when the listview is unfrozen
Suspend selection events until a matching ResumeSelectionEvents()
is called.
Calls to this method nest correctly. Every call to SuspendSelectionEvents()
must have a matching ResumeSelectionEvents().
Resume raising selection events.
Returns a disposable that will disable selection events
during a using() block.
Sort the items by the last sort column and order
Sort the items in the list view by the values in the given column and the last sort order
The name of the column whose values will be used for the sorting
Sort the items in the list view by the values in the given column and the last sort order
The index of the column whose values will be used for the sorting
Sort the items in the list view by the values in the given column and the last sort order
The column whose values will be used for the sorting
Sort the items in the list view by the values in the given column and by the given order.
The column whose values will be used for the sorting.
If null, the first column will be used.
The ordering to be used for sorting. If this is None,
this.Sorting and then SortOrder.Ascending will be used
If ShowGroups is true, the rows will be grouped by the given column.
If AlwaysGroupsByColumn is not null, the rows will be grouped by that column,
and the rows within each group will be sorted by the given column.
Put a sort indicator next to the text of the sort column
Put a sort indicator next to the text of the given given column
The column to be marked
The sort order in effect on that column
If the sort indicator images don't already exist, this method will make and install them
Remove any sorting and revert to the given order of the model objects
Do the actual work of creating the given list of groups
For some reason, UseItemStyleForSubItems doesn't work for the colors
when owner drawing the list, so we have to specifically give each subitem
the desired colors
The item whose subitems are to be corrected
Cells drawn via BaseRenderer don't need this, but it is needed
when an owner drawn cell uses DrawDefault=true
Fill in the given OLVListItem with values of the given row
the OLVListItem that is to be stuff with values
the model object from which values will be taken
Make sure the ListView has the extended style that says to display subitem images.
This method must be called after any .NET call that update the extended styles
since they seem to erase this setting.
Convert the given image selector to an index into our image list.
Return -1 if that's not possible
Index of the image in the imageList, or -1
Return the tooltip that should be shown when the mouse is hovered over the given column
The column index whose tool tip is to be fetched
A string or null if no tool tip is to be shown
Return the tooltip that should be shown when the mouse is hovered over the given cell
The column index whose tool tip is to be fetched
The row index whose tool tip is to be fetched
A string or null if no tool tip is to be shown
Return the OLVListItem that displays the given model object
The modelObject whose item is to be found
The OLVListItem that displays the model, or null
This method has O(n) performance.
Do the work required after the items in a listview have been created
Do the work required after one item in a listview have been created
Prepare the listview to show alternate row backcolors
We cannot rely on lvi.Index in this method.
In a straight list, lvi.Index is the display index, and can be used to determine
whether the row should be colored. But when organised by groups, lvi.Index is not
useable because it still refers to the position in the overall list, not the display order.
Setup all subitem images on all rows
Tell the underlying list control which images to show against the subitems
the index at which the item occurs
the item whose subitems are to be set
Tell the underlying list control which images to show against the subitems
the index at which the item occurs
the item whose subitems are to be set
will existing images be cleared if no new image is provided?
Set the subitem image natively
Take ownership of the 'objects' collection. This separats our collection from the source.
This method
separates the 'objects' instance variable from its source, so that any AddObject/RemoveObject
calls will modify our collection and not the original colleciton.
This method has the intentional side-effect of converting our list of objects to an ArrayList.
Trigger FormatRow and possibly FormatCell events for the given item
Trigger FormatCell events for the given item
Make the list forget everything -- all rows and all columns
Use if you want to remove just the rows.
Update our externally visible image list so it holds the same images as our shadow list, but sized correctly
Return a copy of the given source image list, where each image has been resized to be height x height in size.
If source is null, an empty image list of the given size is returned
Height and width of the new images
Height and width of the new images
Source of the images (can be null)
A new image list
Return a bitmap of the given height x height, which shows the given image, centred.
Height and width of new bitmap
Height and width of new bitmap
Image to be centred
The background color
A new bitmap
Initialize the state image list with the required checkbox images
Setup this control so it can display check boxes on subitems
(or primary checkboxes in virtual mode)
This gives the ListView a small image list, if it doesn't already have one.
Make sure the small image list for this control has checkbox images
(used for sub-item checkboxes).
This gives the ListView a small image list, if it doesn't already have one.
ObjectListView has to manage checkboxes on subitems separate from the checkboxes on each row.
The underlying ListView knows about the per-row checkboxes, and to make them work, OLV has to
correctly configure the StateImageList. However, the ListView cannot do checkboxes in subitems,
so ObjectListView has to handle them in a differnt fashion. So, per-row checkboxes are controlled
by images in the StateImageList, but per-cell checkboxes are handled by images in the SmallImageList.
Owner draw the column header
Owner draw the item
Owner draw a single subitem
We need the click count in the mouse up event, but that is always 1.
So we have to remember the click count from the preceding mouse down event.
When the mouse leaves the control, remove any hot item highlighting
When the mouse moves, we might need to change the hot item.
Check to see if we need to start editing a cell
Tell the world that a hyperlink was clicked and if the event isn't handled,
do the default processing.
Do the default processing for a hyperlink clicked event, which
is to try and open the url.
The user right clicked on the control
This method is called every time a row is selected or deselected. This can be
a pain if the user shift-clicks 100 rows. We override this method so we can
trigger one event for any number of select/deselects that come from one user action
Called when the handle of the underlying control is created
This method is called after the control has been fully created.
Should we start editing the cell in response to the given mouse button event?
Handle a key press on this control. We specifically look for F2 which edits the primary column,
or a Tab character during an edit operation, which tries to start editing on the next (or previous) cell.
Start an editing operation on the first editable column of the given model.
If the model doesn't exist, or there are no editable columns, this method
will do nothing.
This will start an edit operation regardless of CellActivationMode.
Begin an edit operation on the given cell.
This performs various sanity checks and passes off the real work to StartCellEdit().
The row to be edited
The index of the cell to be edited
Really start an edit operation on a given cell. The parameters are assumed to be sane.
The row to be edited
The index of the cell to be edited
Calculate the bounds of the edit control for the given item/column
Calculate the bounds of the edit control for the given item/column, when the listview
is being owner drawn.
A rectangle that is the bounds of the cell editor
Calculate the bounds of the edit control for the given item/column, when the listview
is not being owner drawn.
A rectangle that is the bounds of the cell editor
Try to give the given value to the provided control. Fall back to assigning a string
if the value assignment fails.
A control
The value to be given to the control
The string to be given if the value doesn't work
Setup the given control to be a cell editor
Return the value that the given control is showing
Called when the cell editor could be about to lose focus. Time to commit the change
Return the bounds of the given cell
The row to be edited
The index of the cell to be edited
A Rectangle
Return the bounds of the given cell only until the edge of the current text
The row to be edited
The index of the cell to be edited
A Rectangle
Calculate the visible bounds of the given column. The column's bottom edge is
either the bottom of the last row or the bottom of the control.
The bounds of the control itself
The column
A Rectangle
This returns an empty rectnage if the control isn't in Details mode,
OR has doesn't have any rows, OR if the given column is hidden.
Return a control that can be used to edit the value of the given cell.
The row to be edited
The index of the cell to be edited
A Control to edit the given cell
Get the first non-null value of the given column.
At most 1000 rows will be considered.
The first non-null value, or null if no non-null values were found
Return a TextBox that can be used as a default cell editor.
What column does the cell belong to?
Configure the given text box to autocomplete unique values
from the given column. At most 1000 rows will be considered.
The textbox to configure
The column used to calculate values
Configure the given text box to autocomplete unique values
from the given column. At most 1000 rows will be considered.
The textbox to configure
The column used to calculate values
Consider only this many rows
Stop editing a cell and throw away any changes.
If a cell edit is in progress, finish the edit.
Returns false if the finishing process was cancelled
(i.e. the cell editor is still on screen)
This method does not guarantee that the editing will finish. The validation
process can cause the finishing to be aborted. Developers should check the return value
or use IsCellEditing property after calling this method to see if the user is still
editing a cell.
If a cell edit is in progress, finish the edit.
Returns false if the finishing process was cancelled
(i.e. the cell editor is still on screen)
This method does not guarantee that the editing will finish. The validation
process can cause the finishing to be aborted. Developers should check the return value
or use IsCellEditing property after calling this method to see if the user is still
editing a cell.
True if it is likely that another cell is going to be
edited immediately after this cell finishes editing
Finish the cell edit operation, writing changed data back to the model object
This method does not trigger a Validating event, so it always finishes
the cell edit.
Finish the cell edit operation, writing changed data back to the model object
This method does not trigger a Validating event, so it always finishes
the cell edit.
True if it is likely that another cell is going to be
edited immediately after this cell finishes editing
Remove all trace of any existing cell edit operation
True if it is likely that another cell is going to be
edited immediately after this cell finishes editing
True if the cell editor should be disposed
Force the hot item to be recalculated
Force the hot item to be recalculated
The mouse has moved to the given pt. See if the hot item needs to be updated
Where is the mouse?
This is the main entry point for hot item handling
The mouse has moved to the given pt. See if the hot item needs to be updated
This is the main entry point for hot item handling
Update the given row using the current hot item information
Update the given row using the given hot item information
Apply a style to the given row
Apply a style to a cell
Remove hot item styling from the given row
Add the given decoration to those on this list and make it appear
The decoration
A decoration scrolls with the listview. An overlay stays fixed in place.
Add the given overlay to those on this list and make it appear
The overlay
Draw all the decorations
A Graphics
The items that were redrawn and whose decorations should also be redrawn
Is the given decoration shown on this list
The overlay
Is the given overlay shown on this list?
The overlay
Hide any overlays.
This is only a temporary hiding -- the overlays will be shown
the next time the ObjectListView redraws.
Create and configure the empty list msg overlay
Initialize the standard image and text overlays
Make sure that any overlays are visible.
Refresh the display of the overlays
Refresh the display of just one overlays
Remove the given decoration from this list
The decoration to remove
Remove the given overlay to those on this list
The overlay
Create a filter that will enact all the filtering currently installed
on the visible columns.
Do the actual work of filtering
Remove all column filtering.
Update the filtering of this ObjectListView based on the value filtering
defined in each column
When some setting related to filtering changes, this method is called.
Update all renderers with the currently installed model filter
Gets the checkedness of the given model.
The model
The checkedness of the model. Defaults to unchecked.
Remember the check state of the given model object
The model to be remembered
The model's checkedness
The state given to the method
Forget any persistent checkbox state
Triggered after a ObjectListView has been searched by the user typing into the list
Triggered after a ObjectListView has been sorted
Triggered before a ObjectListView is searched by the user typing into the list
Set Cancelled to true to prevent the searching from taking place.
Changing StringToFind or StartSearchFrom will change the subsequent search.
Triggered before a ObjectListView is sorted
Set Cancelled to true to prevent the sort from taking place.
Changing ColumnToSort or SortOrder will change the subsequent sort.
Triggered after a ObjectListView has created groups
Triggered before a ObjectListView begins to create groups
Set Groups to prevent the default group creation process
Triggered just before a ObjectListView creates groups
You can make changes to the groups, which have been created, before those
groups are created within the listview.
Triggered when a button in a cell is left clicked.
This event is triggered when the user moves a drag over an ObjectListView that
has a SimpleDropSink installed as the drop handler.
Handlers for this event should set the Effect argument and optionally the
InfoMsg property. They can also change any of the DropTarget* setttings to change
the target of the drop.
Triggered when a cell has finished being edited.
Triggered when a cell is about to finish being edited.
If Cancel is already true, the user is cancelling the edit operation.
Set Cancel to true to prevent the value from the cell being written into the model.
You cannot prevent the editing from finishing within this event -- you need
the CellEditValidating event for that.
Triggered when a cell is about to be edited.
Set Cancel to true to prevent the cell being edited.
You can change the the Control to be something completely different.
Triggered when a cell editor needs to be validated
If this event is cancelled, focus will remain on the cell editor.
Triggered when a cell is left clicked.
Triggered when the mouse is above a cell.
Triggered when a cell is right clicked.
This event is triggered when a cell needs a tool tip.
This event is triggered when a checkbox is checked/unchecked on a subitem
Triggered when a column header is right clicked.
This event is triggered when the user releases a drag over an ObjectListView that
has a SimpleDropSink installed as the drop handler.
This event is triggered when the control needs to filter its collection of objects.
This event is triggered when a cell needs to be formatted.
This event is triggered when the frozeness of the control changes.
This event is triggered when a row needs to be formatted.
This event is triggered when a group is about to collapse or expand.
This can be cancelled to prevent the expansion.
This event is triggered when a group changes state.
This event is triggered when a header checkbox is changing value
This event is triggered when a header needs a tool tip.
Triggered when the "hot" item changes
Triggered when a hyperlink cell is clicked.
Triggered when the task text of a group is clicked.
Is the value in the given cell a hyperlink.
Some new objects are about to be added to an ObjectListView.
The contents of the ObjectListView has changed.
The contents of the ObjectListView is about to change via a SetObjects call
Set Cancelled to true to prevent the contents of the list changing. This does not work with virtual lists.
Some objects are about to be removed from an ObjectListView.
This event is triggered when the user moves a drag over an ObjectListView that
has a SimpleDropSink installed as the drop handler, and when the source control
for the drag was an ObjectListView.
Handlers for this event should set the Effect argument and optionally the
InfoMsg property. They can also change any of the DropTarget* setttings to change
the target of the drop.
This event is triggered when the user releases a drag over an ObjectListView that
has a SimpleDropSink installed as the drop handler and when the source control
for the drag was an ObjectListView.
This event is triggered once per user action that changes the selection state
of one or more rows.
This event is triggered when the contents of the ObjectListView has scrolled.
Gets whether or not the left mouse button is down at this very instant
Gets whether the program running on Vista or later?
Gets whether the program running on Win7 or later?
Gets or sets how what smoothing mode will be applied to graphic operations.
Gets or sets how should text be renderered.
Gets or sets the string that will be used to title groups when the group key is null.
Exposed so it can be localized.
Gets or sets whether all ObjectListViews will silently ignore missing aspect errors.
By default, if an ObjectListView is asked to display an aspect
(i.e. a field/property/method)
that does not exist from a model, it displays an error message in that cell, since that
condition is normally a programming error. There are some use cases where
this is not an error -- in those cases, set this to true and ObjectListView will
simply display an empty cell.
Be warned: if you set this to true, it can be very difficult to track down
typing mistakes or name changes in AspectNames.
Gets or sets whether the control will draw a rectangle in each cell showing the cell padding.
This can help with debugging display problems from cell padding.
As with all cell padding, this setting only takes effect when the control is owner drawn.
Gets the style that will be used by default to format disabled rows
Gets the style that will be used by default to format hot rows
Gets or sets an model filter that is combined with any column filtering that the end-user specifies.
This is different from the ModelFilter property, since setting that will replace
any column filtering, whereas setting this will combine this filter with the column filtering
Get or set all the columns that this control knows about.
Only those columns where IsVisible is true will be seen by the user.
If you want to add new columns programmatically, add them to
AllColumns and then call RebuildColumns(). Normally, you do not have to
deal with this property directly. Just use the IDE.
If you do add or remove columns from the AllColumns collection,
you have to call RebuildColumns() to make those changes take effect.
Gets or sets the background color of every second row
Gets the alternate row background color that has been set, or the default color
This property forces the ObjectListView to always group items by the given column.
If AlwaysGroupByColumn is not null, this property will be used to decide how
those groups are sorted. If this property has the value SortOrder.None, then
the sort order will toggle according to the users last header click.
Give access to the image list that is actually being used by the control
Normally, it is preferable to use SmallImageList. Only use this property
if you know exactly what you are doing.
How does the user indicate that they want to edit a cell?
None means that the listview cannot be edited.
Columns can also be marked as editable.
When a cell is edited, should the whole cell be used (minus any space used by checkbox or image)?
Defaults to true.
This is always treated as true when the control is NOT owner drawn.
When this is false and the control is owner drawn,
ObjectListView will try to calculate the width of the cell's
actual contents, and then size the editing control to be just the right width. If this is true,
the whole width of the cell will be used, regardless of the cell's contents.
Each column can have a different value for property. This value from the control is only
used when a column is not specified one way or another.
Regardless of this setting, developers can specify the exact size of the editing control
by listening for the CellEditStarting event.
Gets or sets the engine that will handle key presses during a cell edit operation.
Settings this to null will reset it to default value.
Gets the control that is currently being used for editing a cell.
This will obviously be null if no cell is being edited.
Gets or sets the behaviour of the Tab key when editing a cell on the left or right
edge of the control. If this is false (the default), pressing Tab will wrap to the other side
of the same row. If this is true, pressing Tab when editing the right most cell will advance
to the next row
and Shift-Tab when editing the left-most cell will change to the previous row.
Gets or sets the behaviour of the Enter keys while editing a cell.
If this is false (the default), pressing Enter will simply finish the editing operation.
If this is true, Enter will finish the edit operation and start a new edit operation
on the cell below the current cell, wrapping to the top of the next row when at the bottom cell.
Gets the tool tip control that shows tips for the cells
Gets or sets how many pixels will be left blank around each cell of this item.
Cell contents are aligned after padding has been taken into account.
Each value of the given rectangle will be treated as an inset from
the corresponding side. The width of the rectangle is the padding for the
right cell edge. The height of the rectangle is the padding for the bottom
cell edge.
So, this.olv1.CellPadding = new Rectangle(1, 2, 3, 4); will leave one pixel
of space to the left of the cell, 2 pixels at the top, 3 pixels of space
on the right edge, and 4 pixels of space at the bottom of each cell.
This setting only takes effect when the control is owner drawn.
This setting only affects the contents of the cell. The background is
not affected.
If you set this to a foolish value, your control will appear to be empty.
Gets or sets how cells will be vertically aligned by default.
This setting only takes effect when the control is owner drawn. It will only be noticable
when RowHeight has been set such that there is some vertical space in each row.
Should this list show checkboxes?
Return the model object of the row that is checked or null if no row is checked
or more than one row is checked
Get or set the collection of model objects that are checked.
When setting this property, any row whose model object isn't
in the given collection will be unchecked. Setting to null is
equivilent to unchecking all.
This property returns a simple collection. Changes made to the returned
collection do NOT affect the list. This is different to the behaviour of
CheckedIndicies collection.
.NET's CheckedItems property is not helpful. It is just a short-hand for
iterating through the list looking for items that are checked.
The performance of the get method is O(n), where n is the number of items
in the control. The performance of the set method is
O(n + m) where m is the number of objects being checked. Be careful on long lists.
Gets or sets the checked objects from an enumerable.
Useful for checking all objects in the list.
this.olv1.CheckedObjectsEnumerable = this.olv1.Objects;
Gets Columns for this list. We hide the original so we can associate
a specialised editor with it.
Get/set the list of columns that should be used when the list switches to tile view.
Return the visible columns in the order they are displayed to the user
Get the area of the control that shows the list, minus any header control
Gets or sets if the selected rows should be copied to the clipboard when the user presses Ctrl-C
Gets or sets whether the Control-C copy to clipboard functionality should use
the installed DragSource to create the data object that is placed onto the clipboard.
This is normally what is desired, unless a custom DragSource is installed
that does some very specialized drag-drop behaviour.
Gets the list of decorations that will be drawn the ListView
Do not modify the contents of this list directly. Use the AddDecoration() and RemoveDecoration() methods.
A decoration scrolls with the list contents. An overlay is fixed in place.
When owner drawing, this renderer will draw columns that do not have specific renderer
given to them
If you try to set this to null, it will revert to a HighlightTextRenderer
Gets or sets the style that will be applied to disabled items.
If this is not set explicitly, will be used.
Gets or sets the list of model objects that are disabled.
Disabled objects cannot be selected or activated.
Gets or sets the object that controls how drags start from this control
Gets or sets the object that controls how drops are accepted and processed
by this ListView.
If the given sink is an instance of SimpleDropSink, then events from the drop sink
will be automatically forwarded to the ObjectListView (which means that handlers
for those event can be configured within the IDE).
If this is set to null, the control will not accept drops.
Gets or sets the text that should be shown when there are no items in this list view.
If the EmptyListMsgOverlay has been changed to something other than a TextOverlay,
this property does nothing
Gets or sets the font in which the List Empty message should be drawn
If the EmptyListMsgOverlay has been changed to something other than a TextOverlay,
this property does nothing
Return the font for the 'list empty' message or a reasonable default
Gets or sets the overlay responsible for drawing the List Empty msg.
Gets the collection of objects that survive any filtering that may be in place.
This collection is the result of filtering the current list of objects.
It is not a snapshot of the filtered list that was last used to build the control.
Normal warnings apply when using this with virtual lists. It will work, but it
may take a while.
Gets or sets the strategy object that will be used to build the Filter menu
If this is null, no filter menu will be built.
Gets or sets the row that has keyboard focus
Setting an object to be focused does *not* select it. If you want to select and focus a row,
use .
This property is not generally used and is only useful in specialized situations.
Hide the Groups collection so it's not visible in the Properties grid.
Gets or sets the image list from which group header will take their images
If this is not set, then group headers will not show any images.
Gets how the group label should be formatted when a group is empty or
contains more than one item
The given format string must have two placeholders:
- {0} - the original group title
- {1} - the number of items in the group
"{0} [{1} items]"
Return this.GroupWithItemCountFormat or a reasonable default
Gets how the group label should be formatted when a group contains only a single item
The given format string must have two placeholders:
- {0} - the original group title
- {1} - the number of items in the group (always 1)
"{0} [{1} item]"
Gets GroupWithItemCountSingularFormat or a reasonable default
Gets or sets whether or not the groups in this ObjectListView should be collapsible.
This feature only works under Vista and later.
Does this listview have a message that should be drawn when the list is empty?
Get whether there are any overlays to be drawn
Gets the header control for the ListView
Gets or sets the font in which the text of the column headers will be drawn
Individual columns can override this through their HeaderFormatStyle property.
Gets or sets the style that will be used to draw the columm headers of the listview
This is only used when HeaderUsesThemes is false.
Individual columns can override this through their HeaderFormatStyle property.
Gets or sets the maximum height of the header. -1 means no maximum.
Gets or sets the minimum height of the header. -1 means no minimum.
Gets or sets whether the header will be drawn strictly according to the OS's theme.
If this is set to true, the header will be rendered completely by the system, without
any of ObjectListViews fancy processing -- no images in header, no filter indicators,
no word wrapping, no header styling, no checkboxes.
If this is set to false, ObjectListView will render the header as it thinks best.
If no special features are required, then ObjectListView will delegate rendering to the OS.
Otherwise, ObjectListView will draw the header according to the configuration settings.
The effect of not being themed will be different from OS to OS. At
very least, the sort indicator will not be standard.
Gets or sets the whether the text in the header will be word wrapped.
Line breaks will be applied between words. Words that are too long
will still be ellipsed.
As with all settings that make the header look different, HeaderUsesThemes must be set to false, otherwise
the OS will be responsible for drawing the header, and it does not allow word wrapped text.
Gets the tool tip that shows tips for the column headers
Gets the index of the row that the mouse is currently over
Gets the index of the subitem that the mouse is currently over
Gets the part of the item/subitem that the mouse is currently over
Gets an extended indication of the part of item/subitem/group that the mouse is currently over
Gets the group that the mouse is over
The index of the item that is 'hot', i.e. under the cursor. -1 means no item.
What sort of formatting should be applied to the row under the cursor?
This only takes effect when UseHotItem is true.
If the style has an overlay, it must be set
*before* assigning it to this property. Adding it afterwards will be ignored.
Gets the installed hot item style or a reasonable default.
What sort of formatting should be applied to hyperlinks?
What color should be used for the background of selected rows?
Return the color should be used for the background of selected rows or a reasonable default
What color should be used for the foreground of selected rows?
Return the color should be used for the foreground of selected rows or a reasonable default
Gets or sets whether or not hidden columns should be included in the text representation
of rows that are copied or dragged to another application. If this is false (the default),
only visible columns will be included.
Gets or sets whether or not hidden columns should be included in the text representation
of rows that are copied or dragged to another application. If this is false (the default),
only visible columns will be included.
Return true if a cell edit operation is currently happening
Return true if the ObjectListView is being used within the development environment.
Gets whether or not the current list is filtering its contents
When the user types into a list, should the values in the current sort column be searched to find a match?
If this is false, the primary column will always be used regardless of the sort column.
When this is true, the behavior is like that of ITunes.
Gets or sets if this control will use a SimpleDropSink to receive drops
Setting this replaces any previous DropSink.
After setting this to true, the SimpleDropSink will still need to be configured
to say when it can accept drops and what should happen when something is dropped.
The need to do these things makes this property mostly useless :(
Gets or sets if this control will use a SimpleDragSource to initiate drags
Setting this replaces any previous DragSource
Hide the Items collection so it's not visible in the Properties grid.
This renderer draws the items when in the list is in non-details view.
In details view, the renderers for the individuals columns are responsible.
Which column did we last sort by
This is an alias for PrimarySortColumn
Which direction did we last sort
This is an alias for PrimarySortOrder
Gets or sets the filter that is applied to our whole list of objects.
The list is updated immediately to reflect this filter.
Gets or sets the filter that is applied to each model objects in the list
You may want to consider using instead of this property,
since AdditionalFilter combines with column filtering at runtime. Setting this property simply
replaces any column filter the user may have given.
The list is updated immediately to reflect this filter.
Gets the hit test info last time the mouse was moved.
Useful for hot item processing.
Gets or sets the list of groups shown by the listview.
This property does not work like the .NET Groups property. It should
be treated as a read-only property.
Changes made to the list are NOT reflected in the ListView itself -- it is pointless to add
or remove groups to/from this list. Such modifications will do nothing.
To do such things, you must listen for
BeforeCreatingGroups or AboutToCreateGroups events, and change the list of
groups in those events.
Gets or sets the collection of OLVGroups that are collapsed.
Gets or sets whether the user wants to owner draw the header control
themselves. If this is false (the default), ObjectListView will use
custom drawing to render the header, if needed.
If you listen for the DrawColumnHeader event, you need to set this to true,
otherwise your event handler will not be called.
Get/set the collection of objects that this list will show
The contents of the control will be updated immediately after setting this property.
This method preserves selection, if possible. Use if
you do not want to preserve the selection. Preserving selection is the slowest part of this
code and performance is O(n) where n is the number of selected rows.
This method is not thread safe.
The property DOES work on virtual lists: setting is problem-free, but if you try to get it
and the list has 10 million objects, it may take some time to return.
This collection is unfiltered. Use to access just those objects
that survive any installed filters.
Gets the collection of objects that will be considered when creating clusters
(which are used to generate Excel-like column filters)
Gets or sets the image that will be drawn over the top of the ListView
Gets or sets the text that will be drawn over the top of the ListView
Gets or sets the transparency of all the overlays.
0 is completely transparent, 255 is completely opaque.
This is obsolete. Use Transparency on each overlay.
Gets the list of overlays that will be drawn on top of the ListView
You can add new overlays and remove overlays that you have added, but
don't mess with the overlays that you didn't create.
Gets or sets whether the ObjectListView will be owner drawn. Defaults to true.
When this is true, all of ObjectListView's neat features are available.
We have to reimplement this property, even though we just call the base
property, in order to change the [DefaultValue] to true.
Gets or sets whether or not primary checkboxes will persistent their values across list rebuild
and filtering operations.
This property is only useful when you don't explicitly set CheckStateGetter/Putter.
If you use CheckStateGetter/Putter, the checkedness of a row will already be persisted
by those methods.
This defaults to true. If this is false, checkboxes will lose their values when the
list if rebuild or filtered.
If you set it to false on virtual lists,
you have to install CheckStateGetter/Putters.
Gets or sets a dictionary that remembers the check state of model objects
This is used when PersistentCheckBoxes is true and for virtual lists.
Which column did we last sort by
Which direction did we last sort
Gets or sets if non-editable checkboxes are drawn as disabled. Default is false.
This only has effect in owner drawn mode.
Specify the height of each row in the control in pixels.
The row height in a listview is normally determined by the font size and the small image list size.
This setting allows that calculation to be overridden (within reason: you still cannot set the line height to be
less than the line height of the font used in the control).
Setting it to -1 means use the normal calculation method.
This feature is experiemental! Strange things may happen to your program,
your spouse or your pet if you use it.
How many pixels high is each row?
How many rows appear on each page of this control
Get/set the column that will be used to resolve comparisons that are equal when sorting.
There is no user interface for this setting. It must be set programmatically.
When the SecondarySortColumn is used, in what order will it compare results?
Gets or sets if all rows should be selected when the user presses Ctrl-A
When the user right clicks on the column headers, should a menu be presented which will allow
them to choose which columns will be shown in the view?
This is just a compatibility wrapper for the SelectColumnsOnRightClickBehaviour
property.
Gets or sets how the user will be able to select columns when the header is right clicked
When the column select menu is open, should it stay open after an item is selected?
Staying open allows the user to turn more than one column on or off at a time.
This only works when SelectColumnsOnRightClickBehaviour is set to InlineMenu.
It has no effect when the behaviour is set to SubMenu.
Gets or sets the column that is drawn with a slight tint.
If TintSortColumn is true, the sort column will automatically
be made the selected column.
The colour of the tint is controlled by SelectedColumnTint.
Gets or sets the decoration that will be drawn on all selected rows
What color should be used to tint the selected column?
The tint color must be alpha-blendable, so if the given color is solid
(i.e. alpha = 255), it will be changed to have a reasonable alpha value.
Gets or sets the index of the row that is currently selected.
When getting the index, if no row is selected,or more than one is selected, return -1.
Gets or sets the ListViewItem that is currently selected . If no row is selected, or more than one is selected, return null.
Gets the model object from the currently selected row, if there is only one row selected.
If no row is selected, or more than one is selected, returns null.
When setting, this will select the row that is displaying the given model object and focus on it.
All other rows are deselected.
Get the model objects from the currently selected rows. If no row is selected, the returned List will be empty.
When setting this value, select the rows that is displaying the given model objects. All other rows are deselected.
When the user right clicks on the column headers, should a menu be presented which will allow
them to choose common tasks to perform on the listview?
Gets or sets whether this ObjectListView will show Excel like filtering
menus when the header control is right clicked
Should this list show its items in groups?
Should the list view show a bitmap in the column header to show the sort direction?
The only reason for not wanting to have sort indicators is that, on pre-XP versions of
Windows, having sort indicators required the ListView to have a small image list, and
as soon as you give a ListView a SmallImageList, the text of column 0 is bumped 16
pixels to the right, even if you never used an image.
Should the list view show images on subitems?
Virtual lists have to be owner drawn in order to show images on subitems
This property controls whether group labels will be suffixed with a count of items.
The format of the suffix is controlled by GroupWithItemCountFormat/GroupWithItemCountSingularFormat properties
Gets or sets whether the control will show column headers in all
views (true), or only in Details view (false)
This property is not working correctly. JPP 2010/04/06.
It works fine if it is set before the control is created.
But if it turned off once the control is created, the control
loses its checkboxes (weird!)
To changed this setting after the control is created, things
are complicated. If it is off and we want it on, we have
to change the View and the header will appear. If it is currently
on and we want to turn it off, we have to both change the view
AND recreate the handle. Recreating the handle is a problem
since it makes our checkbox style disappear.
This property doesn't work on XP.
Override the SmallImageList property so we can correctly shadow its operations.
If you use the RowHeight property to specify the row height, the SmallImageList
must be fully initialised before setting/changing the RowHeight. If you add new images to the image
list after setting the RowHeight, you must assign the imagelist to the control again. Something as simple
as this will work:
listView1.SmallImageList = listView1.SmallImageList;
Return the size of the images in the small image list or a reasonable default
When the listview is grouped, should the items be sorted by the primary column?
If this is false, the items will be sorted by the same column as they are grouped.
When the listview is grouped, how many pixels should exist between the end of one group and the
beginning of the next?
Should the sort column show a slight tinge?
Should each row have a tri-state checkbox?
If this is true, the user can choose the third state (normally Indeterminate). Otherwise, user clicks
alternate between checked and unchecked. CheckStateGetter can still return Indeterminate when this
setting is false.
Get or set the index of the top item of this listview
This property only works when the listview is in Details view and not showing groups.
The reason that it does not work when showing groups is that, when groups are enabled,
the Windows msg LVM_GETTOPINDEX always returns 0, regardless of the
scroll position.
Gets or sets whether moving the mouse over the header will trigger CellOver events.
Defaults to true.
Moving the mouse over the header did not previously trigger CellOver events, since the
header is considered a separate control.
If this change in behaviour causes your application problems, set this to false.
If you are interested in knowing when the mouse moves over the header, set this property to true (the default).
When resizing a column by dragging its divider, should any space filling columns be
resized at each mouse move? If this is false, the filling columns will be
updated when the mouse is released.
If you have a space filling column
is in the left of the column that is being resized, this will look odd:
the right edge of the column will be dragged, but
its left edge will move since the space filling column is shrinking.
This is logical behaviour -- it just looks wrong.
Given the above behavior is probably best to turn this property off if your space filling
columns aren't the right-most columns.
What color should be used for the background of selected rows when the control doesn't have the focus?
Return the color should be used for the background of selected rows when the control doesn't have the focus or a reasonable default
What color should be used for the foreground of selected rows when the control doesn't have the focus?
Return the color should be used for the foreground of selected rows when the control doesn't have the focus or a reasonable default
Gets or sets whether the list give a different background color to every second row? Defaults to false.
The color of the alternate rows is given by AlternateRowBackColor.
There is a "feature" in .NET for listviews in non-full-row-select mode, where
selected rows are not drawn with their correct background color.
Should FormatCell events be called for each cell in the control?
In many situations, no cell level formatting is performed. ObjectListView
can run somewhat faster if it does not trigger a format cell event for every cell
unless it is required. So, by default, it does not raise an event for each cell.
ObjectListView *does* raise a FormatRow event every time a row is rebuilt.
Individual rows can decide whether to raise FormatCell
events for every cell in row.
Regardless of this setting, FormatCell events are only raised when the ObjectListView
is in Details view.
Should the selected row be drawn with non-standard foreground and background colors?
v2.9 This property is no longer required
Gets or sets whether this ObjectListView will use the same hot item and selection
mechanism that Vista Explorer does.
This property has many imperfections:
- This only works on Vista and later
- It does not work well with AlternateRowBackColors.
- It does not play well with HotItemStyles.
- It looks a little bit silly is FullRowSelect is false.
- It doesn't work at all when the list is owner drawn (since the renderers
do all the drawing). As such, it won't work with TreeListView's since they *have to be*
owner drawn. You can still set it, but it's just not going to be happy.
But if you absolutely have to look like Vista/Win7, this is your property.
Do not complain if settings this messes up other things.
When this property is set to true, the ObjectListView will be not owner drawn. This will
disable many of the pretty drawing-based features of ObjectListView.
Gets or sets whether the list should enable filtering
Gets or sets whether the list should put an indicator into a column's header to show that
it is filtering on that column
If you set this to true, HeaderUsesThemes is automatically set to false, since
we can only draw a filter indicator when not using a themed header.
Should controls (checkboxes or buttons) that are under the mouse be drawn "hot"?
If this is false, control will not be drawn differently when the mouse is over them.
If this is false AND UseHotItem is false AND UseHyperlinks is false, then the ObjectListView
can skip some processing on mouse move. This make mouse move processing use almost no CPU.
Should the item under the cursor be formatted in a special way?
Gets or sets whether this listview should show hyperlinks in the cells.
Should this control show overlays
Overlays are enabled by default and would only need to be disabled
if they were causing problems in your development environment.
Should this control be configured to show check boxes on subitems?
If this is set to True, the control will be given a SmallImageList if it
doesn't already have one. Also, if it is a virtual list, it will be set to owner
drawn, since virtual lists can't draw check boxes without being owner drawn.
Gets or sets if the ObjectListView will use a translucent selection mechanism like Vista.
Unlike UseExplorerTheme, this Vista-like scheme works on XP and for both
owner and non-owner drawn lists.
This will replace any SelectedRowDecoration that has been installed.
If you don't like the colours used for the selection, ignore this property and
just create your own RowBorderDecoration and assigned it to SelectedRowDecoration,
just like this property setter does.
Gets or sets if the ObjectListView will use a translucent hot row highlighting mechanism like Vista.
Setting this will replace any HotItemStyle that has been installed.
If you don't like the colours used for the hot item, ignore this property and
just create your own HotItemStyle, fill in the values you want, and assigned it to HotItemStyle property,
just like this property setter does.
Get/set the style of view that this listview is using
Switching to tile or details view installs the columns appropriate to that view.
Confusingly, in tile view, every column is shown as a row of information.
This delegate fetches the checkedness of an object as a boolean only.
Use this if you never want to worry about the
Indeterminate state (which is fairly common).
This is a convenience wrapper around the CheckStateGetter property.
This delegate sets the checkedness of an object as a boolean only. It must return
true or false indicating if the object was checked or not.
Use this if you never want to worry about the
Indeterminate state (which is fairly common).
This is a convenience wrapper around the CheckStatePutter property.
Gets whether or not this listview is capabale of showing groups
Gets or sets whether ObjectListView can rely on Application.Idle events
being raised.
In some host environments (e.g. when running as an extension within
VisualStudio and possibly Office), Application.Idle events are never raised.
Set this to false when Idle events will not be raised, and ObjectListView will
raise those events itself.
This delegate fetches the renderer for a particular cell.
If this returns null (or is not installed), the renderer for the column will be used.
If the column renderer is null, then will be used.
This is called every time any cell is drawn. It must be efficient!
This delegate is called when the list wants to show a tooltip for a particular cell.
The delegate should return the text to display, or null to use the default behavior
(which is to show the full text of truncated cell values).
Displaying the full text of truncated cell values only work for FullRowSelect listviews.
This is MS's behavior, not mine. Don't complain to me :)
The name of the property (or field) that holds whether or not a model is checked.
The property be modifiable. It must have a return type of bool (or of bool? if
TriStateCheckBoxes is true).
Setting this property replaces any CheckStateGetter or CheckStatePutter that have been installed.
Conversely, later setting the CheckStateGetter or CheckStatePutter properties will take precedence
over the behavior of this property.
This delegate will be called whenever the ObjectListView needs to know the check state
of the row associated with a given model object.
.NET has no support for indeterminate values, but as of v2.0, this class allows
indeterminate values.
This delegate will be called whenever the user tries to change the check state of a row.
The delegate should return the state that was actually set, which may be different
to the state given.
This delegate can be used to sort the table in a custom fasion.
The delegate must install a ListViewItemSorter on the ObjectListView.
Installing the ItemSorter does the actual work of sorting the ListViewItems.
See ColumnComparer in the code for an example of what an ItemSorter has to do.
Do not install a CustomSorter on a VirtualObjectListView. Override the SortObjects()
method of the IVirtualListDataSource instead.
This delegate is called when the list wants to show a tooltip for a particular header.
The delegate should return the text to display, or null to use the default behavior
(which is to not show any tooltip).
Installing a HeaderToolTipGetter takes precedence over any text in OLVColumn.ToolTipText.
This delegate can be used to format a OLVListItem before it is added to the control.
The model object for the row can be found through the RowObject property of the OLVListItem object.
All subitems normally have the same style as list item, so setting the forecolor on one
subitem changes the forecolor of all subitems.
To allow subitems to have different attributes, do this:
myListViewItem.UseItemStyleForSubItems = false;.
If UseAlternatingBackColors is true, the backcolor of the listitem will be calculated
by the control and cannot be controlled by the RowFormatter delegate.
In general, trying to use a RowFormatter
when UseAlternatingBackColors is true does not work well.
As it says in the summary, this is called before the item is added to the control.
Many properties of the OLVListItem itself are not available at that point, including:
Index, Selected, Focused, Bounds, Checked, DisplayIndex.
Return a point that represents the current horizontal and vertical scroll positions
Gets or sets whether or not ObjectListView should subscribe to INotifyPropertyChanged
events on the model objects that it is given.
This should be set before calling SetObjects(). If you set this to false,
ObjectListView will unsubscribe to all current model objects.
If you set this to true on a virtual list, the ObjectListView will
walk all the objects in the list trying to subscribe to change notifications.
If you have 10,000,000 items in your virtual list, this may take some time.
Gets or set the text to be used for the sorting ascending command
Get or set whether or not the listview is frozen. When the listview is
frozen, it will not update itself.
The Frozen property is similar to the methods Freeze()/Unfreeze()
except that setting Frozen property to false immediately unfreezes the control
regardless of the number of Freeze() calls outstanding.
objectListView1.Frozen = false; // unfreeze the control now!
Returns true if selection events are currently suspended.
While selection events are suspended, neither SelectedIndexChanged
or SelectionChanged events will be raised.
How does a user indicate that they want to edit cells?
This list cannot be edited. F2 does nothing.
A single click on a subitem will edit the value. Single clicking the primary column,
selects the row just like normal. The user must press F2 to edit the primary column.
Double clicking a subitem or the primary column will edit that cell.
F2 will edit the primary column.
Pressing F2 is the only way to edit the cells. Once the primary column is being edited,
the other cells in the row can be edited by pressing Tab.
A single click on a any cell will edit the value, even the primary column.
These values specify how column selection will be presented to the user
No column selection will be presented
The columns will be show in the main menu
The columns will be shown in a submenu
A model dialog will be presented to allow the user to choose columns
Instances of this class are used to store the state of an ObjectListView.
Implementation only class that suspends and resumes selection
events on instance creation and disposal.
Create a VirtualObjectListView
Return the number of items in the list
the number of items in the list
Return the model object at the given index
Index of the model object to be returned
A model object
Find the given model object within the listview and return its index
The model object to be found
The index of the object. -1 means the object was not present
Return the OLVListItem that displays the given model object
The modelObject whose item is to be found
The OLVListItem that displays the model, or null
This method has O(n) performance.
Add the given collection of model objects to this control.
A collection of model objects
The added objects will appear in their correct sort position, if sorting
is active. Otherwise, they will appear at the end of the list.
No check is performed to see if any of the objects are already in the ListView.
Null objects are silently ignored.
Remove all items from this list
This method can safely be called from background threads.
Scroll the listview so that the given group is at the top.
The index of the group to be revealed
If the group is already visible, the list will still be scrolled to move
the group to the top, if that is possible.
This only works when the list is showing groups (obviously).
Inserts the given collection of model objects to this control at hte given location
A collection of model objects
The added objects will appear in their correct sort position, if sorting
is active. Otherwise, they will appear at the given position of the list.
No check is performed to see if any of the objects are already in the ListView.
Null objects are silently ignored.
Update the rows that are showing the given objects
This method does not resort the items.
Update the rows that are selected
This method does not resort or regroup the view.
Remove all of the given objects from the control
Collection of objects to be removed
Nulls and model objects that are not in the ListView are silently ignored.
Due to problems in the underlying ListView, if you remove all the objects from
the control using this method and the list scroll vertically when you do so,
then when you subsequenially add more objects to the control,
the vertical scroll bar will become confused and the control will draw one or more
blank lines at the top of the list.
Select the row that is displaying the given model object. All other rows are deselected.
Model object to select
Should the object be focused as well?
Select the rows that is displaying any of the given model object. All other rows are deselected.
A collection of model objects
This method has O(n) performance where n is the number of model objects passed.
Do not use this to select all the rows in the list -- use SelectAll() for that.
Set the collection of objects that this control will show.
Should the state of the list be preserved as far as is possible.
Get the checkedness of an object from the model. Returning null means the
model does know and the value from the control will be used.
Rebuild the list with its current contents.
Invalidate any cached information when we rebuild the list.
Clear any cached info this list may have been using
Do the work of creating groups for this control
Do the plumbing to disable groups on a virtual list
Do the plumbing to enable groups on a virtual list
Return the position of the given itemIndex in the list as it currently shown to the user.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the last item in the order they are shown to the user.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the n'th item (0-based) in the order they are shown to the user.
If the control is not grouped, the display order is the same as the
sorted list order. But if the list is grouped, the display order is different.
Return the ListViewItem that appears immediately after the given item.
If the given item is null, the first item in the list will be returned.
Return null if the given item is the last item.
The item that is before the item that is returned, or null
A OLVListItem
Return the ListViewItem that appears immediately before the given item.
If the given item is null, the last item in the list will be returned.
Return null if the given item is the first item.
The item that is before the item that is returned
A ListViewItem
Make a list of groups that should be shown according to the given parameters
Create a OLVListItem for given row index
The index of the row that is needed
An OLVListItem
On virtual lists, this cannot work.
Record the change of checkstate for the given object in the model.
This does not update the UI -- only the model
The check state that was recorded and that should be used to update
the control.
Refresh the given item in the list
The item to refresh
Change the size of the list
Take ownership of the 'objects' collection. This separates our collection from the source.
This method
separates the 'objects' instance variable from its source, so that any AddObject/RemoveObject
calls will modify our collection and not the original colleciton.
VirtualObjectListViews always own their collections, so this is a no-op.
Change the state of the control to reflect changes in filtering
Change the size of the virtual list so that it matches its data source
Handle the CacheVirtualItems event
Handle a RetrieveVirtualItem
Handle the SearchForVirtualList event, which is called when the user types into a virtual list
Find the first row in the given range of rows that prefix matches the string value of the given column.
The index of the matched row, or -1
Gets whether or not this listview is capabale of showing groups
Get or set the collection of model objects that are checked.
When setting this property, any row whose model object isn't
in the given collection will be unchecked. Setting to null is
equivilent to unchecking all.
This property returns a simple collection. Changes made to the returned
collection do NOT affect the list. This is different to the behaviour of
CheckedIndicies collection.
When getting CheckedObjects, the performance of this method is O(n) where n is the number of checked objects.
When setting CheckedObjects, the performance of this method is O(n) where n is the number of checked objects plus
the number of objects to be checked.
If the ListView is not currently showing CheckBoxes, this property does nothing. It does
not remember any check box settings made.
This class optimizes the management of CheckStates so that it will work efficiently even on
large lists of item. However, those optimizations are impossible if you install a CheckStateGetter.
With a CheckStateGetter installed, the performance of this method is O(n) where n is the size
of the list. This could be painfully slow.
Gets or sets whether or not an object will be included in the CheckedObjects
collection, even if it is not present in the control at the moment
This property is an implementation detail and should not be altered.
Gets the collection of objects that survive any filtering that may be in place.
Gets or sets the strategy that will be used to create groups
This must be provided for a virtual list to show groups.
Gets whether or not the current list is filtering its contents
This is only possible if our underlying data source supports filtering.
Get/set the collection of objects that this list will show
The contents of the control will be updated immediately after setting this property.
Setting this property preserves selection, if possible. Use SetObjects() if
you do not want to preserve the selection. Preserving selection is the slowest part of this
code -- performance is O(n) where n is the number of selected rows.
This method is not thread safe.
The property DOES work on virtual lists, but if you try to iterate through a list
of 10 million objects, it may take some time :)
This delegate is used to fetch a rowObject, given it's index within the list
Only use this property if you are not using a VirtualListDataSource.
Should this list show its items in groups?
Get/set the data source that is behind this virtual list
Setting this will cause the list to redraw.
Gets or sets the number of rows in this virtual list.
There is an annoying feature/bug in the .NET ListView class.
When you change the VirtualListSize property, it always scrolls so
that the focused item is the top item. This is annoying since it makes
the virtual list seem to flicker as the control scrolls to show the focused
item and then scrolls back to where ObjectListView wants it to be.
Trigger the expanding event
Trigger the collapsing event
Trigger the expanded event
Trigger the collapsed event
Make a default TreeListView
Make sure that at least one column is displaying a tree.
If no columns is showing the tree, make column 0 do it.
Return true if the branch at the given model is expanded
Collapse the subtree underneath the given model
Collapse all subtrees within this control
Remove all items from this list
This method can safely be called from background threads.
Collapse all roots and forget everything we know about all models
Expand the subtree underneath the given model object
Expand all the branches within this tree recursively.
Be careful: this method could take a long time for large trees.
Completely rebuild the tree structure
If true, the control will try to preserve selection and expansion
Completely rebuild the tree structure
If not null, this list of objects will be selected after the tree is rebuilt
If not null, this collection of objects will be expanded after the tree is rebuilt
If not null, this collection of objects will be checked after the tree is rebuilt
Unroll all the ancestors of the given model and make sure it is then visible.
This works best when a ParentGetter is installed.
The object to be revealed
If true, the model will be selected and focused after being revealed
True if the object was found and revealed. False if it was not found.
Update the rows that are showing the given objects
Change the check state of the given object to be the given state.
If the given model object isn't in the list, we still try to remember
its state, in case it is referenced in the future.
True if the checkedness of the model changed
Toggle the expanded state of the branch at the given model object
Return whether or not the given model can expand.
The given model must have already been seen in the tree
Return the model object that is the parent of the given model object.
The given model must have already been seen in the tree.
Return the collection of model objects that are the children of the
given model as they exist in the tree at the moment.
This method returns the collection of children as the tree knows them. If the given
model has never been presented to the user (e.g. it belongs to a parent that has
never been expanded), then this method will return an empty collection.
Because of this, if you want to traverse the whole tree, this is not the method to use.
It's better to traverse the your data model directly.
If the given model has not already been seen in the tree or
if it is not expandable, an empty collection will be returned.
Handle a left button down event
Create a OLVListItem for given row index
The index of the row that is needed
An OLVListItem
This differs from the base method by also setting up the IndentCount property.
Reinitialize the Tree structure
Recalculate the state of the checkboxes of all the items in the given list
and their ancestors.
This only makes sense when HierarchicalCheckboxes is true.
Recalculate the hierarchy state of the given item and its ancestors
This only makes sense when HierarchicalCheckboxes is true.
Yield the unique ancestors of the given collection of objects.
The order of the ancestors is guaranteed to be deeper objects first.
Roots will always be last.
Unique ancestors of the given objects
Return all the ancestors of the given model
This uses ParentGetter if possible.
If the given model is a root OR if the model doesn't exist, the collection will be empty
The model whose ancestors should be calculated
Return a collection of ancestors of the given model.
The application is idle and a SelectionChanged event has been scheduled
Decide if the given key event should be handled as a normal key input to the control?
Handle focus being lost, including making sure that the whole control is redrawn.
Handle the keyboard input to mimic a TreeView.
Was the key press handled?
This event is triggered when user input requests the expansion of a list item.
This event is triggered when user input requests the collapse of a list item.
This event is triggered after the expansion of a list item due to user input.
This event is triggered after the collapse of a list item due to user input.
This is the delegate that will be used to decide if a model object can be expanded.
This is called *often* -- on every mouse move when required. It must be fast.
Don't do database lookups, linear searches, or pi calculations. Just return the
value of a property.
When this delegate is called, the TreeListView is not in a stable state. Don't make
calls back into the control.
Gets whether or not this listview is capable of showing groups
This is the delegate that will be used to fetch the children of a model object
This delegate will only be called if the CanExpand delegate has
returned true for the model object.
When this delegate is called, the TreeListView is not in a stable state. Don't do anything
that will result in calls being made back into the control.
This is the delegate that will be used to fetch the parent of a model object
The parent of the given model, or null if the model doesn't exist or
if the model is a root
Get or set the collection of model objects that are checked.
When setting this property, any row whose model object isn't
in the given collection will be unchecked. Setting to null is
equivalent to unchecking all.
This property returns a simple collection. Changes made to the returned
collection do NOT affect the list. This is different to the behaviour of
CheckedIndicies collection.
When getting CheckedObjects, the performance of this method is O(n) where n is the number of checked objects.
When setting CheckedObjects, the performance of this method is O(n) where n is the number of checked objects plus
the number of objects to be checked.
If the ListView is not currently showing CheckBoxes, this property does nothing. It does
not remember any check box settings made.
Gets or sets the model objects that are expanded.
This can be used to expand model objects before they are seen.
Setting this does *not* force the control to rebuild
its display. You need to call RebuildAll(true).
Gets or sets the filter that is applied to our whole list of objects.
TreeListViews do not currently support whole list filters.
Gets or sets whether this tree list view will display hierarchical checkboxes.
Hierarchical checkboxes is when a parent's "checkedness" is calculated from
the "checkedness" of its children. If all children are checked, the parent
will be checked. If all children are unchecked, the parent will also be unchecked.
If some children are checked and others are not, the parent will be indeterminate.
Hierarchical checkboxes don't work with either CheckStateGetters or CheckedAspectName
(which is basically the same thing). This is because it is too expensive to build the
initial state of the control if these are installed, since the control would have to walk
*every* branch recursively since a single bottom level leaf could change the checkedness
of the top root.
Gets or sets the collection of root objects of the tree
Gets the collection of objects that will be considered when creating clusters
(which are used to generate Excel-like column filters)
After expanding a branch, should the TreeListView attempts to show as much of the
revealed descendents as possible.
The model objects that form the top level branches of the tree.
Setting this does NOT reset the state of the control.
In particular, it does not collapse branches.
Gets or sets the renderer that will be used to draw the tree structure.
Setting this to null resets the renderer to default.
If a column is currently rendering the tree, the renderer
for that column will be replaced. If no column is rendering the tree,
column 0 will be given this renderer.
This is the delegate that will be used to create the underlying Tree structure
that the TreeListView uses to manage the information about the tree.
The factory must not return null.
Most users of TreeListView will never have to use this delegate.
Should a wait cursor be shown when a branch is being expanded?
When this is true, the wait cursor will be shown whilst the children of the
branch are being fetched. If the children of the branch have already been cached,
the cursor will not change.
Gets the model that is used to manage the tree structure
Don't mess with this property unless you really know what you are doing.
If you don't already know what it's for, you don't need it.
This class handles drawing the tree structure of the primary column.
This renderer highlights substrings that match a given text filter.
A BaseRenderer provides useful base level functionality for any custom renderer.
Subclasses will normally override the Render or OptionalRender method, and use the other
methods as helper functions.
An AbstractRenderer is a do-nothing implementation of the IRenderer interface.
Renderers are the mechanism used for owner drawing cells. As such, they can also handle
hit detection and positioning of cell editing rectangles.
Render the whole item within an ObjectListView. This is only used in non-Details views.
The event
A Graphics for rendering
The bounds of the item
The model object to be drawn
Return true to indicate that the event was handled and no further processing is needed.
Render one cell within an ObjectListView when it is in Details mode.
The event
A Graphics for rendering
The bounds of the cell
The model object to be drawn
Return true to indicate that the event was handled and no further processing is needed.
What is under the given point?
x co-ordinate
y co-ordinate
This method should only alter HitTestLocation and/or UserData.
When the value in the given cell is to be edited, where should the edit rectangle be placed?
Render the whole item within an ObjectListView. This is only used in non-Details views.
The event
A Graphics for rendering
The bounds of the item
The model object to be drawn
Return true to indicate that the event was handled and no further processing is needed.
Render one cell within an ObjectListView when it is in Details mode.
The event
A Graphics for rendering
The bounds of the cell
The model object to be drawn
Return true to indicate that the event was handled and no further processing is needed.
What is under the given point?
x co-ordinate
y co-ordinate
This method should only alter HitTestLocation and/or UserData.
When the value in the given cell is to be edited, where should the edit rectangle be placed?
Align the second rectangle with the first rectangle,
according to the alignment of the column
The cell's bounds
The rectangle to be aligned within the bounds
An aligned rectangle
Calculate the left edge of the rectangle that aligns the outer rectangle with the inner one
according to this renderer's horizontal alignment
Calculate the top of the rectangle that aligns the outer rectangle with the inner rectangle
according to this renders vertical alignment
Calculate the top of the rectangle that aligns the outer rectangle with a rectangle of the given height
according to this renderer's vertical alignment
Calculate the space that our rendering will occupy and then align that space
with the given rectangle, according to the Column alignment
Pre-padded bounds of the cell
Calculate the size of the content of this cell.
Pre-padded bounds of the cell
The width and height of the content
Calculate the bounds of a checkbox given the (pre-padded) cell bounds
Pre-padded cell bounds
How much space will the check box for this cell occupy?
Only column 0 can have check boxes. Sub item checkboxes are
treated as images
How much space will the check box for this row occupy?
If the list doesn't have checkboxes, or this isn't the primary column,
this returns an empty size.
How much horizontal space will the image of this cell occupy?
How much vertical space will the image of this cell occupy?
How much space will the image of this cell occupy?
How much horizontal space will the text of this cell occupy?
How much space will the text of this cell occupy?
Return the Color that is the background color for this item's cell
The background color of the subitem
Return the color of the background color when the item is selected
The background color of the subitem
Return the color to be used for text in this cell
The text color of the subitem
Return the color of the foreground color when the item is selected
The foreground color of the subitem
Return the image that should be drawn against this subitem
An Image or null if no image should be drawn.
Return the actual image that should be drawn when keyed by the given image selector.
An image selector can be:
- an int, giving the index into the image list
- a string, giving the image key into the image list
- an Image, being the image itself
The value that indicates the image to be used
An Image or null
Return the string that should be drawn within this
Return the Color that is the background color for this item's text
The background color of the subitem's text
Render the whole item in a non-details view.
Prepare this renderer to draw in response to the given event
Use this if you want to chain a second renderer within a primary renderer.
Render one cell
Prepare this renderer to draw in response to the given event
Use this if you want to chain a second renderer within a primary renderer.
Calculate which part of this cell was hit
Calculate the edit rectangle
Draw our data into the given rectangle using the given graphics context.
Subclasses should override this method.
The graphics context that should be used for drawing
The bounds of the subitem cell
Returns whether the rendering has already taken place.
If this returns false, the default processing will take over.
Draw our data into the given rectangle using the given graphics context.
Subclasses should override this method if they never want
to fall back on the default processing
The graphics context that should be used for drawing
The bounds of the subitem cell
Do the actual work of hit testing. Subclasses should override this rather than HitTest()
Handle a HitTest request after all state information has been initialized
Draw the standard "[checkbox] [image] [text]" cell after the state properties have been initialized.
Change the bounds of the given rectangle to take any cell padding into account
Perform normal hit testing relative to the given aligned content bounds
This method calculates the bounds of the text within a standard layout
(i.e. optional checkbox, optional image, text)
This method only works correctly if the state of the renderer
has been fully initialized (see BaseRenderer.GetEditRectangle)
Apply any padding to the given bounds, and then align a rectangle of the given
size within that padded area.
Draw the given image aligned horizontally within the column.
Over tall images are scaled to fit. Over-wide images are
truncated. This is by design!
Graphics context to use for drawing
Bounds of the cell
The image to be drawn
Draw our subitems image and text
Graphics context to use for drawing
Pre-padded bounds of the cell
Fill in the background of this cell
Graphics context to use for drawing
Bounds of the cell
Draw the primary check box of this row (checkboxes in other sub items use a different method)
Graphics context to use for drawing
The pre-aligned and padded target rectangle
Calculate the CheckBoxState we need to correctly draw the given state
Draw the given text and optional image in the "normal" fashion
Graphics context to use for drawing
Bounds of the cell
The optional image to be drawn
Draw our subitems image and text
Graphics context to use for drawing
Bounds of the cell
Draw the given collection of image selectors
Draw the given text and optional image in the "normal" fashion
Graphics context to use for drawing
Bounds of the cell
The string to be drawn
Print the given text in the given rectangle using only GDI routines
The native list control uses GDI routines to do its drawing, so using them
here makes the owner drawn mode looks more natural.
This method doesn't honour the CanWrap setting on the renderer. All
text is single line
Print the given text in the given rectangle using normal GDI+ .NET methods
Printing to a printer dc has to be done using this method.
Can the renderer wrap lines that do not fit completely within the cell?
Wrapping text doesn't work with the GDI renderer.
Gets or sets how many pixels will be left blank around this cell
This setting only takes effect when the control is owner drawn.
for more details.
Gets the horiztonal alignment of the column
Gets or sets how cells drawn by this renderer will be vertically aligned.
If this is not set, the value from the column or control itself will be used.
Gets the optional padding that this renderer should apply before drawing.
This property considers all possible sources of padding
Gets the vertical cell alignment that should govern the rendering.
This property considers all possible sources.
Gets or sets the image list from which keyed images will be fetched
When rendering multiple images, how many pixels should be between each image?
Should text be rendered using GDI routines? This makes the text look more
like a native List view control.
Get or set the aspect of the model object that this renderer should draw
What are the bounds of the cell that is being drawn?
Get or set the OLVColumn that this renderer will draw
Get/set the event that caused this renderer to be called
Get/set the event that caused this renderer to be called
Gets or sets the font to be used for text in this cell
Gets the image list from which keyed images will be fetched
Should this renderer fill in the background before drawing?
Cache whether or not our item is selected
Is this renderer being used on a printer context?
Get or set the listitem that this renderer will be drawing
Get/set the listview for which the drawing is to be done
Get the specialized OLVSubItem that this renderer is drawing
This returns null for column 0.
Get or set the model object that this renderer should draw
Get or set the list subitem that this renderer will be drawing
The brush that will be used to paint the text
Will this renderer use the custom images from the parent ObjectListView
to draw the checkbox images.
If this is true, the renderer will use the images from the
StateImageList to represent checkboxes. 0 - unchecked, 1 - checked, 2 - indeterminate.
If this is false (the default), then the renderer will use .NET's standard
CheckBoxRenderer.
Should this checkbox be drawn as disabled?
Is the current item hot (i.e. under the mouse)?
Is the mouse over a checkbox in this cell?
Gets the cell's vertical alignment as a TextFormatFlag
Gets the StringFormat needed when drawing text using GDI+
Renderers that implement this interface will have the filter property updated,
each time the filter on the ObjectListView is updated.
Create a HighlightTextRenderer
Create a HighlightTextRenderer
Create a HighlightTextRenderer
Handle a HitTest request after all state information has been initialized
Draw text using GDI
Draw the highlighted text using GDI
Draw an indication around the given frame that shows a text match
Draw the text using GDI+
Draw the highlighted text using GDI+
Return a GraphicPath that is a round cornered rectangle
A round cornered rectangle path
If I could rely on people using C# 3.0+, this should be
an extension method of GraphicsPath.
Return a GraphicPath that is a round cornered rectangle
The rectangle
The diameter of the corners
A round cornered rectangle path
If I could rely on people using C# 3.0+, this should be
an extension method of GraphicsPath.
Gets or set how rounded will be the corners of the text match frame
Gets or set the brush will be used to paint behind the matched substrings.
Set this to null to not fill the frame.
Gets or sets the filter that is filtering the ObjectListView and for
which this renderer should highlight text
When a filter changes, keep track of the text matching filters
Gets or set the pen will be used to frame the matched substrings.
Set this to null to not draw a frame.
Gets or sets whether the frame around a text match will have rounded corners
Gets or set the text that will be highlighted
Gets or sets the manner in which substring will be compared.
Use this to control if substring matches are case sensitive or insensitive.
Gets whether the renderer should actually draw highlighting
Create a TreeRenderer
How many pixels will be reserved for each level of indentation?
The real work of drawing the tree is done in this method
Draw the expansion indicator
Draw the expansion indicator using styles
Draw the expansion indicator without using styles
Draw the lines of the tree
Do the hit test
Calculate the edit rect
Should the renderer draw glyphs at the expansion points?
The expansion points will still function to expand/collapse even if this is false.
Should the renderer draw lines connecting siblings?
Return the pen that will be used to draw the lines between branches
Should the renderer draw triangles as the expansion glyphs?
This looks best with ShowLines = false
Return the branch that the renderer is currently drawing.
Return the TreeListView for which the renderer is being used.
Gets whether or not we should render using styles
Is the mouse over a checkbox in this cell?
Delegates of this type are use to decide if the given model object can be expanded
The model under consideration
Can the given model be expanded?
Delegates of this type are used to fetch the children of the given model object
The parent whose children should be fetched
An enumerable over the children
Delegates of this type are used to fetch the parent of the given model object.
The child whose parent should be fetched
The parent of the child or null if the child is a root
Delegates of this type are used to create a new underlying Tree structure.
The view for which the Tree is being created
A subclass of Tree
A Tree object represents a tree structure data model that supports both
tree and flat list operations as well as fast access to branches.
If you create a subclass of Tree, you must install it in the TreeListView
via the TreeFactory delegate.
A VirtualListDataSource is a complete manner to provide functionality to a virtual list.
An object that implements this interface provides a VirtualObjectListView with all the
information it needs to be fully functional.
Implementors must provide functioning implementations of at least GetObjectCount()
and GetNthObject(), otherwise nothing will appear in the list.
Return the object that should be displayed at the n'th row.
The index of the row whose object is to be returned.
The model object at the n'th row, or null if the fetching was unsuccessful.
Return the number of rows that should be visible in the virtual list
The number of rows the list view should have.
Get the index of the row that is showing the given model object
The model object sought
The index of the row showing the model, or -1 if the object could not be found.
The ListView is about to request the given range of items. Do
whatever caching seems appropriate.
Find the first row that "matches" the given text in the given range.
The text typed by the user
Start searching from this index. This may be greater than the 'to' parameter,
in which case the search should descend
Do not search beyond this index. This may be less than the 'from' parameter.
The column that should be considered when looking for a match.
Return the index of row that was matched, or -1 if no match was found
Sort the model objects in the data source.
Add the given collection of model objects to this control.
A collection of model objects
Insert the given collection of model objects to this control at the position
Index where the collection will be added
A collection of model objects
Remove all of the given objects from the control
Collection of objects to be removed
Set the collection of objects that this control will show.
Update/replace the nth object with the given object
This extension allow virtual lists to filter their contents
All subsequent retrievals on this data source should be filtered
through the given filters. null means no filtering of that kind.
Create a Tree
Collapse the subtree underneath the given model
The model to be collapsed. If the model isn't in the tree,
or if it is already collapsed, the command does nothing.
The index of the model in flat list version of the tree
Collapse all branches in this tree
Nothing useful
Expand the subtree underneath the given model object
The model to be expanded.
The index of the model in flat list version of the tree
If the model isn't in the tree,
if it cannot be expanded or if it is already expanded, the command does nothing.
Expand all branches in this tree
Return the index of the first branch that was expanded
Return the Branch object that represents the given model in the tree
The model whose branches is to be returned
The branch that represents the given model, or null if the model
isn't in the tree.
Return the number of visible descendents that are below the given model.
The model whose descendent count is to be returned
The number of visible descendents. 0 if the model doesn't exist or is collapsed
Rebuild the children of the given model, refreshing any cached information held about the given object
The index of the model in flat list version of the tree
Is the given model expanded?
Remember whether or not the given model was expanded
Insert the children of the given branch into the given position
The branch whose children should be inserted
The index where the children should be inserted
Rebuild our flat internal list of objects.
Rebuild our reverse index that maps an object to its location
in the filteredObjectList array.
Create a new branch within this tree
Sort the tree on the given column and in the given order
Add the given collection of objects to the roots of this tree
Remove all of the given objects from the roots of the tree.
Any objects that is not already in the roots collection is ignored.
Set the roots of this tree to be the given collection
Update/replace the nth object with the given object
Should the given model be included in this control?
The model to consider
True if it will be included
This is the delegate that will be used to decide if a model object can be expanded.
This is the delegate that will be used to fetch the children of a model object
This delegate will only be called if the CanExpand delegate has
returned true for the model object.
Get or return the top level model objects in the tree
What tree view is this Tree the model for?
Is this list currently being filtered?
A Branch represents a sub-tree within a tree
Create a Branch
Clear any cached information that this branch is holding
Collapse this branch
Expand this branch
Expand this branch recursively
Collapse all branches in this tree
Nothing useful
Fetch the children of this branch.
This should only be called when CanExpand is true.
Collapse the visible descendents of this branch into list of model objects
Flatten this branch's visible descendents onto the given list.
The branch itself is not included in the list.
Force a refresh of all children recursively
Sort the sub-branches and their descendents so they are ordered according
to the given comparer.
The comparer that orders the branches
Get the ancestor branches of this branch, with the 'oldest' ancestor first.
Can this branch be expanded?
Gets or sets our children
Get/set the model objects that are beneath this branch
Gets a list of all the branches that survive filtering
Gets or set whether this branch is expanded
Return true if this branch is the first branch of the entire tree
Return true if this branch is the last child of its parent
Return true if this branch is the only top level branch
Gets the depth level of this branch
Gets or sets which model is represented by this branch
Return the number of descendents of this branch that are currently visible
Gets or sets our parent branch
Gets or sets our overall tree
Is this branch currently visible? A branch is visible
if it has no parent (i.e. it's a root), or its parent
is visible and expanded.
Indicators for branches
FirstBranch of tree
LastChild of parent
OnlyBranch of tree
This class sorts branches according to how their respective model objects are sorted
Create a BranchComparer
Order the two branches
Gets or sets whether or not columns will be automatically generated to show the
columns when the DataSource is set.
This must be set before the DataSource is set. It has no effect afterwards.
Get or set the DataSource that will be displayed in this list view.
The DataSource should implement either , ,
or . Some common examples are the following types of objects:
When binding to a list container (i.e. one that implements the
interface, such as )
you must also set the property in order
to identify which particular list you would like to display. You
may also set the property even when
DataSource refers to a list, since can
also be used to navigate relations between lists.
Gets or sets the name of the list or table in the data source for which the DataListView is displaying data.
If the data source is not a DataSet or DataViewManager, this property has no effect
Gets or sets the name of the property/column that uniquely identifies each row.
The value contained by this column must be unique across all rows
in the data source. Odd and unpredictable things will happen if two
rows have the same id.
Null cannot be a valid key value.
Gets or sets the name of the property/column that contains the key of
the parent of a row.
The test condition for deciding if one row is the parent of another is functionally
equivilent to this:
Object.Equals(candidateParentRow[this.KeyAspectName], row[this.ParentKeyAspectName])
Unlike key value, parent keys can be null but a null parent key can only be used
to identify root objects.
Gets or sets the value that identifies a row as a root object.
When the ParentKey of a row equals the RootKeyValue, that row will
be treated as root of the TreeListView.
The test condition for deciding a root object is functionally
equivilent to this:
Object.Equals(candidateRow[this.ParentKeyAspectName], this.RootKeyValue)
The RootKeyValue can be null. Actually, it can be any value that can
be compared for equality against a basic type.
If this is set to the wrong value (i.e. to a value that no row
has in the parent id column), the list will be empty.
Gets or sets the value that identifies a row as a root object.
. The RootKeyValue can be of any type,
but the IDE cannot sensibly represent a value of any type,
so this is a typed wrapper around that property.
If you want the root value to be something other than a string,
you will have set it yourself.
Gets or sets whether or not the key columns (id and parent id) should
be shown to the user.
This must be set before the DataSource is set. It has no effect
afterwards.
Gets or sets the DataSourceAdaptor that does the bulk of the work needed
for data binding.
A data transfer object that knows how to transform a list of model
objects into a text and HTML representation.
Create a data object from the selected objects in the given ObjectListView
The source of the data object
Create a data object which operates on the given model objects
in the given ObjectListView
The source of the data object
The model objects to be put into the data object
Put a text and HTML representation of our model objects
into the data object.
Create an exporter for the data contained in this object
Make a HTML representation of our model objects
Convert the fragment of HTML into the Clipboards HTML format.
The HTML format is found here http://msdn2.microsoft.com/en-us/library/aa767917.aspx
The HTML to put onto the clipboard. It must be valid HTML!
A string that can be put onto the clipboard and will be recognized as HTML
Gets or sets whether hidden columns will also be included in the text
and HTML representation. If this is false, only visible columns will
be included.
Gets or sets whether column headers will also be included in the text
and HTML representation.
Gets the ObjectListView that is being used as the source of the data
Gets the model objects that are to be placed in the data object
This enum is used to indicate various portions of a datetime
Year
Month
Day of the month
Hour
Minute
Second
This class implements a strategy where the model objects are clustered
according to some portion of the datetime value in the configured column.
To create a strategy that grouped people who were born in
the same month, you would create a strategy that extracted just
the month, and formatted it to show just the month's name. Like this:
someColumn.ClusteringStrategy = new DateTimeClusteringStrategy(DateTimePortion.Month, "MMMM");
This class provides a useful base implemention of a clustering
strategy where the clusters are grouped around the value of a given column.
Implementation of this interface control the selecting of cluster keys
and how those clusters will be presented to the user
Get the cluster key by which the given model will be partitioned by this strategy
If the returned value is an IEnumerable, the given model is considered
to belong to multiple clusters
Create a cluster to hold the given cluster key
Gets the display label that the given cluster should use
Create a filter that will include only model objects that
match one or more of the given values.
Gets or sets the column upon which this strategy will operate
This field is the text that will be shown to the user when a cluster
key is null. It is exposed so it can be localized.
This field is the text that will be shown to the user when a cluster
key is empty (i.e. a string of zero length). It is exposed so it can be localized.
Create a clustering strategy
Get the cluster key by which the given model will be partitioned by this strategy
Create a cluster to hold the given cluster key
Gets the display label that the given cluster should use
Create a filter that will include only model objects that
match one or more of the given values.
Create a label that combines the string representation of the cluster
key with a format string that holds an "X [N items in cluster]" type layout.
Gets or sets the format that will be used by default for clusters that only
contain 1 item. The format string must accept two placeholders:
- {0} is the cluster key converted to a string
- {1} is the number of items in the cluster (always 1 in this case)
Gets or sets the format that will be used by default for clusters that
contain 0 or two or more items. The format string must accept two placeholders:
- {0} is the cluster key converted to a string
- {1} is the number of items in the cluster
Gets or sets the column upon which this strategy is operating
Gets or sets the format that will be used when the cluster
contains only 1 item. The format string must accept two placeholders:
- {0} is the cluster key converted to a string
- {1} is the number of items in the cluster (always 1 in this case)
If this is not set, the value from
ClusteringStrategy.DefaultDisplayLabelFormatSingular will be used
Gets or sets the format that will be used when the cluster
contains 0 or two or more items. The format string must accept two placeholders:
- {0} is the cluster key converted to a string
- {1} is the number of items in the cluster
If this is not set, the value from
ClusteringStrategy.DefaultDisplayLabelFormatPlural will be used
Create a strategy that clusters by month/year
Create a strategy that clusters around the given parts
Get the cluster key by which the given model will be partitioned by this strategy
Gets the display label that the given cluster should use
Convert the given date into a user presentable string
Gets or sets the format string will will be used to create a user-presentable
version of the cluster key.
The format should use the date/time format strings, as documented
in the Windows SDK. Both standard formats and custom format will work.
"D" - long date pattern
"MMMM, yyyy" - "January, 1999"
Gets or sets the parts of the DateTime that will be extracted when
determining the clustering key for an object.
Instances of this class cluster model objects on the basis of a
property that holds an xor-ed collection of bit flags.
Create a clustering strategy that operates on the flags of the given enum
Create a clustering strategy around the given collections of flags and their display labels.
There must be the same number of elements in both collections.
The list of flags.
Get the cluster key by which the given model will be partitioned by this strategy
Gets the display label that the given cluster should use
Create a filter that will include only model objects that
match one or more of the given values.
Gets the value that will be xor-ed to test for the presence of a particular value.
Gets the labels that will be used when the corresponding Value is XOR present in the data.
Instances of this class include only those rows of the listview
that match one or more given strings.
This class can match strings by prefix, regex, or simple containment.
There are factory methods for each of these matching strategies.
Base class for model-by-model filters
Interface for model-by-model filtering
Should the given model be included when this filter is installed
The model object to consider
Returns true if the model will be included by the filter
Should the given model be included when this filter is installed
The model object to consider
Returns true if the model will be included by the filter
Create a text filter that will include rows where any cell matches
any of the given regex expressions.
Any string that is not a valid regex expression will be ignored.
Create a text filter that includes rows where any cell begins with one of the given strings
Create a text filter that includes rows where any cell contains any of the given strings.
Create a TextFilter
Create a TextFilter that finds the given string
Create a TextFilter that finds the given string using the given comparison
Loop over the columns that are being considering by the filter
Do the actual work of filtering
Find all the ways in which this filter matches the given string.
This is used by the renderer to decide which bits of
the string should be highlighted
A list of character ranges indicating the matched substrings
Is the given column one of the columns being used by this filter?
Gets or sets which columns will be used for the comparisons? If this is null, all columns will be used
Gets or sets additional columns which will be used in the comparison. These will be used
in addition to either the Columns property or to all columns taken from the control.
Gets or sets the collection of strings that will be used for
contains matching. Setting this replaces all previous texts
of any kind.
Gets whether or not this filter has any search criteria
Gets or set the ObjectListView upon which this filter will work
You cannot really rebase a filter after it is created, so do not change this value.
It is included so that it can be set in an object initializer.
Gets or sets the collection of strings that will be used for
prefix matching. Setting this replaces all previous texts
of any kind.
Gets or sets the options that will be used when compiling the regular expression.
This is only used when doing Regex matching (obviously).
If this is not set specifically, the appropriate options are chosen to match the
StringComparison setting (culture invariant, case sensitive).
Gets or sets the collection of strings that will be used for
regex pattern matching. Setting this replaces all previous texts
of any kind.
Gets or sets how the filter will match text
Base class for the various types of string matching that TextMatchFilter provides
Find all the ways in which this filter matches the given string.
This is used by the renderer to decide which bits of
the string should be highlighted.
this.Text will not be null or empty when this is called.
The text of the cell we want to search
A list of character ranges indicating the matched substrings
Does the given text match the filter
this.Text will not be null or empty when this is called.
The text of the cell we want to search
Return true if the given cellText matches our strategy
Gets how the filter will match text
Gets the text filter to which this component belongs
Gets or sets the text that will be matched
This component provides text contains matching strategy.
Create a text contains strategy
Does the given text match the filter
this.Text will not be null or empty when this is called.
The text of the cell we want to search
Return true if the given cellText matches our strategy
Find all the ways in which this filter matches the given string.
This is used by the renderer to decide which bits of
the string should be highlighted.
this.Text will not be null or empty when this is called.
The text of the cell we want to search
A list of character ranges indicating the matched substrings
This component provides text begins with matching strategy.
Create a text begins strategy
Does the given text match the filter
this.Text will not be null or empty when this is called.
The text of the cell we want to search
Return true if the given cellText matches our strategy
Find all the ways in which this filter matches the given string.
This is used by the renderer to decide which bits of
the string should be highlighted.
this.Text will not be null or empty when this is called.
The text of the cell we want to search
A list of character ranges indicating the matched substrings
This component provides regex matching strategy.
Creates a regex strategy
Does the given text match the filter
this.Text will not be null or empty when this is called.
The text of the cell we want to search
Return true if the given cellText matches our strategy
Find all the ways in which this filter matches the given string.
This is used by the renderer to decide which bits of
the string should be highlighted.
this.Text will not be null or empty when this is called.
The text of the cell we want to search
A list of character ranges indicating the matched substrings
Gets or sets the options that will be used when compiling the regular expression.
Gets or sets a compilex regular expression, based on our current Text and RegexOptions.
If Text fails to compile as a regular expression, this will return a Regex object
that will match all strings.
Gets whether or not our current regular expression is a valid regex
These delegates are used to extract an aspect from a row object
These delegates are used to put a changed value back into a model object
These delegates can be used to convert an aspect value to a display string,
instead of using the default ToString()
These delegates are used to get the tooltip for a cell
These delegates are used to the state of the checkbox for a row object.
For reasons known only to someone in Microsoft, we can only set
a boolean on the ListViewItem to indicate it's "checked-ness", but when
we receive update events, we have to use a tristate CheckState. So we can
be told about an indeterminate state, but we can't set it ourselves.
As of version 2.0, we can now return indeterminate state.
These delegates are used to get the state of the checkbox for a row object.
These delegates are used to put a changed check state back into a model object
These delegates are used to put a changed check state back into a model object
These delegates are used to get the renderer for a particular cell
The callbacks for RightColumnClick events
This delegate will be used to own draw header column.
This delegate is called when a group has been created but not yet made
into a real ListViewGroup. The user can take this opportunity to fill
in lots of other details about the group.
These delegates are used to retrieve the object that is the key of the group to which the given row belongs.
These delegates are used to convert a group key into a title for the group
These delegates are used to get the tooltip for a column header
These delegates are used to fetch the image selector that should be used
to choose an image for this column.
These delegates are used to draw a cell
These delegates are used to fetch a row object for virtual lists
These delegates are used to format a listviewitem before it is added to the control.
These delegates can be used to return the array of texts that should be searched for text filtering
These delegates are used to sort the listview in some custom fashion
These delegates are used to order two strings.
x cannot be null. y can be null.
This class contains all the settings used when groups are created
Create a GroupingParameters
Gets or sets the ObjectListView being grouped
Gets or sets the column used to create groups
In what order will the groups themselves be sorted?
If this is set, this comparer will be used to order the groups
If this is set, this comparer will be used to order items within each group
Gets or sets the column that will be the primary sort
Gets or sets the ordering for the primary sort
Gets or sets the column used for secondary sorting
Gets or sets the ordering for the secondary sort
Gets or sets the title format used for groups with zero or more than one element
Gets or sets the title format used for groups with only one element
Gets or sets whether the items should be sorted by the primary column
A simple-minded implementation of a Dictionary that can handle null as a key.
The type of the dictionary key
The type of the values to be stored
This is not a full implementation and is only meant to handle
collecting groups by their keys, since groups can have null as a key value.
OLVListItems are specialized ListViewItems that know which row object they came from,
and the row index at which they are displayed, even when in group view mode. They
also know the image they should draw against themselves
Create a OLVListItem for the given row object
Create a OLVListItem for the given row object, represented by the given string and image
Return the sub item at the given index
Index of the subitem to be returned
An OLVListSubItem
Return bounds of the given subitem
This correctly calculates the bounds even for column 0.
Gets the bounding rectangle of the item, including all subitems
Gets or sets how many pixels will be left blank around each cell of this item
This setting only takes effect when the control is owner drawn.
Gets or sets how the cells of this item will be vertically aligned
This setting only takes effect when the control is owner drawn.
Gets or sets the checkedness of this item.
Virtual lists don't handle checkboxes well, so we have to intercept attempts to change them
through the items, and change them into something that will work.
Unfortunately, this won't work if this property is set through the base class, since
the property is not declared as virtual.
Enable tri-state checkbox.
.NET's Checked property was not built to handle tri-state checkboxes,
and will return True for both Checked and Indeterminate states.
Gets if this item has any decorations set for it.
Gets or sets the decoration that will be drawn over this item
Setting this replaces all other decorations
Gets the collection of decorations that will be drawn over this item
Gets whether or not this row can be selected and activated
Gets whether any cell on this item is showing a hyperlink
Get or set the image that should be shown against this item
This can be an Image, a string or an int. A string or an int will
be used as an index into the small image list.
Gets or sets the the model object that is source of the data for this list item.
Gets or sets the color that will be used for this row's background when it is selected and
the control is focused.
To work reliably, this property must be set during a FormatRow event.
If this is not set, the normal selection BackColor will be used.
Gets or sets the color that will be used for this row's foreground when it is selected and
the control is focused.
To work reliably, this property must be set during a FormatRow event.
If this is not set, the normal selection ForeColor will be used.
A ListViewSubItem that knows which image should be drawn against it.
Create a OLVListSubItem
Create a OLVListSubItem that shows the given string and image
Return the state of the animatation of the image on this subitem.
Null means there is either no image, or it is not an animation
Gets or sets how many pixels will be left blank around this cell
This setting only takes effect when the control is owner drawn.
Gets or sets how this cell will be vertically aligned
This setting only takes effect when the control is owner drawn.
Gets or sets the model value is being displayed by this subitem.
Gets if this subitem has any decorations set for it.
Gets or sets the decoration that will be drawn over this item
Setting this replaces all other decorations
Gets the collection of decorations that will be drawn over this item
Get or set the image that should be shown against this item
This can be an Image, a string or an int. A string or an int will
be used as an index into the small image list.
Gets or sets the url that should be invoked when this subitem is clicked
Gets or sets whether this cell is selected
An indication of where a hit was within ObjectListView cell
Nowhere
On the text
On the image
On the checkbox
On the expand button (TreeListView)
in a button (cell must have ButtonRenderer)
in the cell but not in any more specific location
UserDefined location1 (used for custom renderers)
On the expand/collapse widget of the group
Somewhere on a group
Somewhere in a column header
Somewhere in a column header checkbox
Somewhere in a header divider
A collection of ListViewHitTest constants
Instances of this class encapsulate the information gathered during a OlvHitTest()
operation.
Custom renderers can use HitTestLocation.UserDefined and the UserData
object to store more specific locations for use during event handlers.
Create a OlvListViewHitTestInfo
Create a OlvListViewHitTestInfo when the header was hit
Where is the hit location?
Where is the hit location?
Which group was hit?
Custom renderers can use this information to supply more details about the hit location
Returns a string that represents the current object.
A string that represents the current object.
2
Gets the item that was hit
Gets the subitem that was hit
Gets the part of the subitem that was hit
Gets the ObjectListView that was tested
Gets the model object that was hit
Gets the index of the row under the hit point or -1
Gets the index of the column under the hit point
Gets the index of the header divider
Gets the column that was hit
A TreeDataSourceAdapter knows how to build a tree structure from a binding list.
To build a tree
A helper class that translates DataSource events for an ObjectListView
Make a DataSourceAdapter
Finalize this object
Release all the resources used by this instance
Release all the resources used by this instance
Our data source has changed. Figure out how to handle the new source
Our data source has changed. Figure out how to handle the new source
The data source for this control has changed. Reconfigure the control for the new source
Take the contents of the currently bound list and put them into the control
Create columns for the listview based on what properties are available in the data source
This method will create columns if there is not already a column displaying that property.
Decide if a new column should be added to the control to display
the given property
Configure the given column to show the given property.
The title and aspect name of the column are already filled in.
Generate aspect getters and putters for any columns that are missing them (and for which we have
enough information to actually generate a getter)
CurrencyManager ListChanged event handler.
Deals with fine-grained changes to list items.
It's actually difficult to deal with these changes in a fine-grained manner.
If our listview is grouped, then any change may make a new group appear or
an old group disappear. It is rarely enough to simply update the affected row.
Handle PropertyDescriptor* events
Handle ItemMoved event
Handle the ItemDeleted event
Handle an ItemAdded event.
Handle the Reset event
Handle ItemChanged event. This is triggered when a single item
has changed, so just refresh that one item.
Even in this simple case, we should probably rebuild the list.
For example, the change could put the item into its own new group.
The CurrencyManager calls this if the data source looks
different. We just reload everything.
CHECK: Do we need this if we are handle ListChanged metadata events?
Called by the CurrencyManager when the currently selected item
changes. We update the ListView selection so that we stay in sync
with any other controls bound to the same source.
Change the control's position (which is it's currently selected row)
to the nth row in the dataset
The index of the row to be selected
Handle the selection changing in our ListView.
We need to tell our currency manager about the new position.
Handle the frozenness of our ListView changing.
Handle a change to the BindingContext of our ListView.
Gets or sets whether or not columns will be automatically generated to show the
columns when the DataSource is set.
This must be set before the DataSource is set. It has no effect afterwards.
Get or set the DataSource that will be displayed in this list view.
Gets or sets the name of the list or table in the data source for which the DataListView is displaying data.
If the data source is not a DataSet or DataViewManager, this property has no effect
Gets the ObjectListView upon which this adaptor will operate
Gets or sets the currency manager which is handling our binding context
Create a data source adaptor that knows how to build a tree structure
Gets or sets the name of the property/column that uniquely identifies each row.
The value contained by this column must be unique across all rows
in the data source. Odd and unpredictable things will happen if two
rows have the same id.
Null cannot be a valid key value.
Gets or sets the name of the property/column that contains the key of
the parent of a row.
The test condition for deciding if one row is the parent of another is functionally
equivilent to this:
Object.Equals(candidateParentRow[this.KeyAspectName], row[this.ParentKeyAspectName])
Unlike key value, parent keys can be null but a null parent key can only be used
to identify root objects.
Gets or sets the value that identifies a row as a root object.
When the ParentKey of a row equals the RootKeyValue, that row will
be treated as root of the TreeListView.
The test condition for deciding a root object is functionally
equivilent to this:
Object.Equals(candidateRow[this.ParentKeyAspectName], this.RootKeyValue)
The RootKeyValue can be null.
Gets or sets whether or not the key columns (id and parent id) should
be shown to the user.
This must be set before the DataSource is set. It has no effect
afterwards.
Gets the DataTreeListView that is being managed
An OLVColumn knows which aspect of an object it should present.
The column knows how to:
- extract its aspect from the row object
- convert an aspect to a string
- calculate the image for the row object
- extract a group "key" from the row object
- convert a group "key" into a title for the group
For sorting to work correctly, aspects from the same column
must be of the same type, that is, the same aspect cannot sometimes
return strings and other times integers.
Create an OLVColumn
Initialize a column to have the given title, and show the given aspect
The title of the column
The aspect to be shown in the column
Create a ColumnButtonRenderer to draw buttons in this column
Fill in details to our ColumnButtonRenderer based on the properties set on the column
For a given group value, return the string that should be used as the groups title.
The group key that is being converted to a title
string
Get the checkedness of the given object for this column
The row object that is being displayed
The checkedness of the object
Put the checkedness of the given object for this column
The row object that is being displayed
The checkedness of the object
For a given row object, extract the value indicated by the AspectName property of this column.
The row object that is being displayed
An object, which is the aspect named by AspectName
For a given row object, return the object that is the key of the group that this row belongs to.
The row object that is being displayed
Group key object
For a given row object, return the image selector of the image that should displayed in this column.
The row object that is being displayed
int or string or Image. int or string will be used as index into image list. null or -1 means no image
Return the image that represents the check box for the given model
For a given row object, return the strings that will be searched when trying to filter by string.
This will normally be the simple GetStringValue result, but if this column is non-textual (e.g. image)
you might want to install a SearchValueGetter delegate which can return something that could be used
for text filtering.
The array of texts to be searched. If this returns null, search will not match that object.
For a given row object, return the string representation of the value shown in this column.
For aspects that are string (e.g. aPerson.Name), the aspect and its string representation are the same.
For non-strings (e.g. aPerson.DateOfBirth), the string representation is very different.
For a given row object, return the object that is to be displayed in this column.
The row object that is being displayed
An object, which is the aspect to be displayed
Update the given model object with the given value using the column's
AspectName.
The model object to be updated
The value to be put into the model
Update the given model object with the given value
The model object to be updated
The value to be put into the model
Convert the aspect object to its string representation.
If the column has been given a AspectToStringConverter, that will be used to do
the conversion, otherwise just use ToString().
The returned value will not be null. Nulls are always converted
to empty strings.
The value of the aspect that should be displayed
A string representation of the aspect
Decide the clustering strategy that will be used for this column
Tell the world when visibility of a column changes.
Create groupies
This is an untyped version to help with Generator and OLVColumn attributes
Create groupies
Create groupies
Create groupies
Create groupies.
Install delegates that will group the columns aspects into progressive partitions.
If an aspect is less than value[n], it will be grouped with description[n].
If an aspect has a value greater than the last element in "values", it will be grouped
with the last element in "descriptions".
Array of values. Values must be able to be
compared to the aspect (using IComparable)
The description for the matching value. The last element is the default description.
If there are n values, there must be n+1 descriptions.
this.salaryColumn.MakeGroupies(
new UInt32[] { 20000, 100000 },
new string[] { "Lowly worker", "Middle management", "Rarified elevation"});
Create groupies based on exact value matches.
Install delegates that will group rows into partitions based on equality of this columns aspects.
If an aspect is equal to value[n], it will be grouped with description[n].
If an aspect is not equal to any value, it will be grouped with "[other]".
Array of values. Values must be able to be
equated to the aspect
The description for the matching value.
this.marriedColumn.MakeEqualGroupies(
new MaritalStatus[] { MaritalStatus.Single, MaritalStatus.Married, MaritalStatus.Divorced, MaritalStatus.Partnered },
new string[] { "Looking", "Content", "Looking again", "Mostly content" });
This delegate will be used to extract a value to be displayed in this column.
If this is set, AspectName is ignored.
Remember if this aspect getter for this column was generated internally, and can therefore
be regenerated at will
The name of the property or method that should be called to get the value to display in this column.
This is only used if a ValueGetterDelegate has not been given.
This name can be dotted to chain references to properties or parameter-less methods.
"DateOfBirth"
"Owner.HomeAddress.Postcode"
This delegate will be used to put an edited value back into the model object.
This does nothing if IsEditable == false.
The delegate that will be used to translate the aspect to display in this column into a string.
If this value is set, AspectToStringFormat will be ignored.
This format string will be used to convert an aspect to its string representation.
This string is passed as the first parameter to the String.Format() method.
This is only used if AspectToStringConverter has not been set.
"{0:C}" to convert a number to currency
Gets or sets whether the cell editor should use AutoComplete
Gets or sets whether the cell editor should use AutoComplete
Gets whether this column can be hidden by user actions
This take into account both the Hideable property and whether this column
is the primary column of the listview (column 0).
When a cell is edited, should the whole cell be used (minus any space used by checkbox or image)?
This is always treated as true when the control is NOT owner drawn.
When this is false (the default) and the control is owner drawn,
ObjectListView will try to calculate the width of the cell's
actual contents, and then size the editing control to be just the right width. If this is true,
the whole width of the cell will be used, regardless of the cell's contents.
If this property is not set on the column, the value from the control will be used
This value is only used when the control is in Details view.
Regardless of this setting, developers can specify the exact size of the editing control
by listening for the CellEditStarting event.
Get whether the whole cell should be used when editing a cell in this column
This calculates the current effective value, which may be different to CellEditUseWholeCell
Gets or sets how many pixels will be left blank around this cells in this column
This setting only takes effect when the control is owner drawn.
Gets or sets how cells in this column will be vertically aligned.
This setting only takes effect when the control is owner drawn.
If this is not set, the value from the control itself will be used.
Gets or sets whether this column will show a checkbox.
Setting this on column 0 has no effect. Column 0 check box is controlled
by the CheckBoxes property on the ObjectListView itself.
Gets or sets the clustering strategy used for this column.
The clustering strategy is used to build a Filtering menu for this item.
If this is null, a useful default will be chosen.
To disable filtering on this colummn, set UseFiltering to false.
Cluster strategies belong to a particular column. The same instance
cannot be shared between multiple columns.
Gets or sets whether the button in this column (if this column is drawing buttons) will be enabled
even if the row itself is disabled
Should this column resize to fill the free space in the listview?
If you want two (or more) columns to equally share the available free space, set this property to True.
If you want this column to have a larger or smaller share of the free space, you must
set the FreeSpaceProportion property explicitly.
Space filling columns are still governed by the MinimumWidth and MaximumWidth properties.
///
What proportion of the unoccupied horizontal space in the control should be given to this column?
There are situations where it would be nice if a column (normally the rightmost one) would expand as
the list view expands, so that as much of the column was visible as possible without having to scroll
horizontally (you should never, ever make your users have to scroll anything horizontally!).
A space filling column is resized to occupy a proportion of the unoccupied width of the listview (the
unoccupied width is the width left over once all the the non-filling columns have been given their space).
This property indicates the relative proportion of that unoccupied space that will be given to this column.
The actual value of this property is not important -- only its value relative to the value in other columns.
For example:
-
If there is only one space filling column, it will be given all the free space, regardless of the value in FreeSpaceProportion.
-
If there are two or more space filling columns and they all have the same value for FreeSpaceProportion,
they will share the free space equally.
-
If there are three space filling columns with values of 3, 2, and 1
for FreeSpaceProportion, then the first column with occupy half the free space, the second will
occupy one-third of the free space, and the third column one-sixth of the free space.
Gets or sets whether groups will be rebuild on this columns values when this column's header is clicked.
This setting is only used when ShowGroups is true.
If this is false, clicking the header will not rebuild groups. It will not provide
any feedback as to why the list is not being regrouped. It is the programmers responsibility to
provide appropriate feedback.
When this is false, BeforeCreatingGroups events are still fired, which can be used to allow grouping
or give feedback, on a case by case basis.
This delegate is called when a group has been created but not yet made
into a real ListViewGroup. The user can take this opportunity to fill
in lots of other details about the group.
This delegate is called to get the object that is the key for the group
to which the given row belongs.
This delegate is called to convert a group key into a title for that group.
When the listview is grouped by this column and group title has an item count,
how should the lable be formatted?
The given format string can/should have two placeholders:
- {0} - the original group title
- {1} - the number of items in the group
"{0} [{1} items]"
Gets this.GroupWithItemCountFormat or a reasonable default
If GroupWithItemCountFormat is not set, its value will be taken from the ObjectListView if possible.
When the listview is grouped by this column and a group title has an item count,
how should the lable be formatted if there is only one item in the group?
The given format string can/should have two placeholders:
- {0} - the original group title
- {1} - the number of items in the group (always 1)
"{0} [{1} item]"
Get this.GroupWithItemCountSingularFormat or a reasonable default
If this value is not set, the values from the list view will be used
Gets whether this column should be drawn with a filter indicator in the column header.
Gets or sets a delegate that will be used to own draw header column.
Gets or sets the style that will be used to draw the header for this column
This is only uses when the owning ObjectListView has HeaderUsesThemes set to false.
Gets or sets the font in which the header for this column will be drawn
You should probably use a HeaderFormatStyle instead of this property
This is only uses when HeaderUsesThemes is false.
Gets or sets the color in which the text of the header for this column will be drawn
You should probably use a HeaderFormatStyle instead of this property
This is only uses when HeaderUsesThemes is false.
Gets or sets whether the text values in this column will act like hyperlinks
This is only taken into account when HeaderUsesThemes is false.
Gets or sets how the text of the header will be drawn?
Return the text alignment of the header. This will either have been set explicitly,
or will follow the alignment of the text in the column
Gets the header alignment converted to a StringAlignment
Gets whether or not this column has an image in the header
Gets or sets whether this header will place a checkbox in the header
Gets or sets whether this header will place a tri-state checkbox in the header
Gets or sets the checkedness of the checkbox in the header of this column
Gets or sets whether the
checking/unchecking the value of the header's checkbox will result in the
checkboxes for all cells in this column being set to the same checked/unchecked.
Defaults to true.
There is no reverse of this function that automatically updates the header when the
checkedness of a cell changes.
This property's behaviour on a TreeListView is probably best describes as undefined
and should be avoided.
The performance of this action (checking/unchecking all rows) is O(n) where n is the
number of rows. It will work on large virtual lists, but it may take some time.
Gets or sets whether the checkbox in the header is disabled
Clicking on a disabled checkbox does not change its value, though it does raise
a HeaderCheckBoxChanging event, which allows the programmer the opportunity to do
something appropriate.
Gets or sets whether this column can be hidden by the user.
Column 0 can never be hidden, regardless of this setting.
Gets or sets whether the text values in this column will act like hyperlinks
This is the name of property that will be invoked to get the image selector of the
image that should be shown in this column.
It can return an int, string, Image or null.
This is ignored if ImageGetter is not null.
The property can use these return value to identify the image:
- null or -1 -- indicates no image
- an int -- the int value will be used as an index into the image list
- a String -- the string value will be used as a key into the image list
- an Image -- the Image will be drawn directly (only in OwnerDrawn mode)
This delegate is called to get the image selector of the image that should be shown in this column.
It can return an int, string, Image or null.
This delegate can use these return value to identify the image:
- null or -1 -- indicates no image
- an int -- the int value will be used as an index into the image list
- a String -- the string value will be used as a key into the image list
- an Image -- the Image will be drawn directly (only in OwnerDrawn mode)
Gets or sets whether this column will draw buttons in its cells
When this is set to true, the renderer for the column is become a ColumnButtonRenderer
if it isn't already. If this is set to false, any previous button renderer will be discarded
If the cell's aspect is null or empty, nothing will be drawn in the cell.
Gets or sets the maximum width that a button can occupy.
-1 means there is no maximum width.
This is only considered when the SizingMode is TextBounds
Gets or sets the extra space that surrounds the cell when the SizingMode is TextBounds
Gets or sets the size of the button when the SizingMode is FixedBounds
If this is not set, the bounds of the cell will be used
Gets or sets how each button will be sized if this column is displaying buttons
Can the values shown in this column be edited?
This defaults to true, since the primary means to control the editability of a listview
is on the listview itself. Once a listview is editable, all the columns are too, unless the
programmer explicitly marks them as not editable
Is this column a fixed width column?
Get/set whether this column should be used when the view is switched to tile view.
Column 0 is always included in tileview regardless of this setting.
Tile views do not work well with many "columns" of information.
Two or three works best.
Gets or sets whether the text of this header should be rendered vertically.
If this is true, it is a good idea to set ToolTipText to the name of the column so it's easy to read.
Vertical headers are text only. They do not draw their image.
Can this column be seen by the user?
After changing this value, you must call RebuildColumns() before the changes will take effect.
Where was this column last positioned within the Detail view columns
DisplayIndex is volatile. Once a column is removed from the control,
there is no way to discover where it was in the display order. This property
guards that information even when the column is not in the listview's active columns.
What is the maximum width that the user can give to this column?
-1 means there is no maximum width. Give this the same value as MinimumWidth to make a fixed width column.
What is the minimum width that the user can give to this column?
-1 means there is no minimum width. Give this the same value as MaximumWidth to make a fixed width column.
Get/set the renderer that will be invoked when a cell needs to be redrawn
This delegate is called when a cell needs to be drawn in OwnerDrawn mode.
This method is kept primarily for backwards compatibility.
New code should implement an IRenderer, though this property will be maintained.
Gets or sets whether the text in this column's cell will be used when doing text searching.
If this is false, text filters will not trying searching this columns cells when looking for matches.
Gets or sets a delegate which will return the array of text values that should be
considered for text matching when using a text based filter.
Gets or sets whether the header for this column will include the column's Text.
If this is false, the only thing rendered in the column header will be the image from .
This setting is only considered when is false on the owning ObjectListView.
Gets or sets whether the contents of the list will be resorted when the user clicks the
header of this column.
If this is false, clicking the header will not sort the list, but will not provide
any feedback as to why the list is not being sorted. It is the programmers responsibility to
provide appropriate feedback.
When this is false, BeforeSorting events are still fired, which can be used to allow sorting
or give feedback, on a case by case basis.
Gets or sets the horizontal alignment of the contents of the column.
.NET will not allow column 0 to have any alignment except
to the left. We can't change the basic behaviour of the listview,
but when owner drawn, column 0 can now have other alignments.
Gets the StringAlignment equivilent of the column text alignment
What string should be displayed when the mouse is hovered over the header of this column?
If a HeaderToolTipGetter is installed on the owning ObjectListView, this
value will be ignored.
Should this column have a tri-state checkbox?
If this is true, the user can choose the third state (normally Indeterminate).
Group objects by the initial letter of the aspect of the column
One common pattern is to group column by the initial letter of the value for that group.
The aspect must be a string (obviously).
Gets or sets whether or not this column should be user filterable
Gets or sets a filter that will only include models where the model's value
for this column is one of the values in ValuesChosenForFiltering
Gets or sets the values that will be used to generate a filter for this
column. For a model to be included by the generated filter, its value for this column
must be in this list. If the list is null or empty, this column will
not be used for filtering.
What is the width of this column?
Gets or set whether the contents of this column's cells should be word wrapped
If this column uses a custom IRenderer (that is, one that is not descended
from BaseRenderer), then that renderer is responsible for implementing word wrapping.
Gets or sets the type of data shown in this column.
If this is not set, it will try to get the type
by looking through the rows of the listview.
This event is triggered when the visibility of this column changes.
How should the button be sized?
Every cell will have the same sized button, as indicated by ButtonSize property
Every cell will draw a button that fills the cell, inset by ButtonPadding
Each button will be resized to contain the text of the Aspect
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized resource of type System.Drawing.Bitmap.
Looks up a localized resource of type System.Drawing.Bitmap.
Looks up a localized resource of type System.Drawing.Bitmap.
Looks up a localized resource of type System.Drawing.Bitmap.
Looks up a localized resource of type System.Drawing.Bitmap.
An adorment is the common base for overlays and decorations.
Calculate the location of rectangle of the given size,
so that it's indicated corner would be at the given point.
The point
Which corner will be positioned at the reference point
CalculateAlignedPosition(new Point(50, 100), new Size(10, 20), System.Drawing.ContentAlignment.TopLeft) -> Point(50, 100)
CalculateAlignedPosition(new Point(50, 100), new Size(10, 20), System.Drawing.ContentAlignment.MiddleCenter) -> Point(45, 90)
CalculateAlignedPosition(new Point(50, 100), new Size(10, 20), System.Drawing.ContentAlignment.BottomRight) -> Point(40, 80)
Calculate a rectangle that has the given size which is positioned so that
its alignment point is at the reference location of the given rect.
Create a rectangle of the given size which is positioned so that
its indicated corner is at the indicated corner of the reference rect.
Creates a rectangle so that its bottom left is at the centre of the reference:
corner=BottomLeft, referenceCorner=MiddleCenter
This is a powerful concept that takes some getting used to, but is
very neat once you understand it.
Return the point at the indicated corner of the given rectangle (it doesn't
have to be a corner, but a named location)
The reference rectangle
Which point of the rectangle should be returned?
A point
CalculateReferenceLocation(new Rectangle(0, 0, 50, 100), System.Drawing.ContentAlignment.TopLeft) -> Point(0, 0)
CalculateReferenceLocation(new Rectangle(0, 0, 50, 100), System.Drawing.ContentAlignment.MiddleCenter) -> Point(25, 50)
CalculateReferenceLocation(new Rectangle(0, 0, 50, 100), System.Drawing.ContentAlignment.BottomRight) -> Point(50, 100)
Given the item and the subitem, calculate its bounds.
Apply any specified rotation to the Graphic content.
The Graphics to be transformed
The rotation will be around the centre of this rect
Reverse the rotation created by ApplyRotation()
Gets or sets the corner of the adornment that will be positioned at the reference corner
Gets or sets location within the reference rectange where the adornment will be drawn
This is a simplied interface to ReferenceCorner and AdornmentCorner
Gets or sets the offset by which the position of the adornment will be adjusted
Gets or sets the point of the reference rectangle to which the adornment will be aligned.
Gets or sets the degree of rotation by which the adornment will be transformed.
The centre of rotation will be the center point of the adornment.
Gets or sets the transparency of the overlay.
0 is completely transparent, 255 is completely opaque.
An overlay that will draw an image over the top of the ObjectListView
Draw the image in its specified location
The Graphics used for drawing
The bounds of the rendering
Draw the image in its specified location
The image to be drawn
The Graphics used for drawing
The bounds of the rendering
How transparent should the image be (0 is completely transparent, 255 is opaque)
Draw the image in its specified location
The image to be drawn
The Graphics used for drawing
The bounds of the rendering
How big should the image be?
How transparent should the image be (0 is completely transparent, 255 is opaque)
Draw the image in its specified location, scaled so that it is not wider
than the given rectangle. Height is scaled proportional to the width.
The image to be drawn
The Graphics used for drawing
The bounds of the rendering
How transparent should the image be (0 is completely transparent, 255 is opaque)
Utility to draw a bitmap transparenly.
Gets or sets the image that will be drawn
Gets or sets if the image will be shrunk to fit with its horizontal bounds
An adornment that will draw text
Draw our text with our stored configuration in relation to the given
reference rectangle
The Graphics used for drawing
The reference rectangle in relation to which the text will be drawn
Draw the given text with our stored configuration
The Graphics used for drawing
The reference rectangle in relation to which the text will be drawn
The text to draw
How opaque should be text be
Draw the text with a border
The Graphics used for drawing
The bounds within which the text should be drawn
The text to draw
How opaque should be text be
Return the rectangle that will be the precise bounds of the displayed text
The bounds of the text
Return a GraphicPath that is a round cornered rectangle
The rectangle
The diameter of the corners
A round cornered rectagle path
If I could rely on people using C# 3.0+, this should be
an extension method of GraphicsPath.
Gets or sets the background color of the text
Set this to Color.Empty to not draw a background
Gets the brush that will be used to paint the text
Gets or sets the color of the border around the billboard.
Set this to Color.Empty to remove the border
Gets the brush that will be used to paint the text
Gets or sets the width of the border around the text
How rounded should the corners of the border be? 0 means no rounding.
If this value is too large, the edges of the border will appear odd.
Gets or sets the font that will be used to draw the text
Gets the font that will be used to draw the text or a reasonable default
Does this text have a background?
Does this overlay have a border?
Gets or sets the maximum width of the text. Text longer than this will wrap.
0 means no maximum.
Gets or sets the formatting that should be used on the text
Gets or sets the text that will be drawn
Gets the brush that will be used to paint the text
Gets or sets the color of the text
Gets or sets whether the text will wrap when it exceeds its bounds
This attribute is used to mark a property of a model
class that should be noticed by Generator class.
All the attributes of this class match their equivilent properties on OLVColumn.
Create a new OLVColumnAttribute
Create a new OLVColumnAttribute with the given title
The title of the column
An array of IComparables that mark the cutoff points for values when
grouping on this column.
Properties marked with [OLVChildren] will be used as the children source in a TreeListView.
Properties marked with [OLVIgnore] will not have columns generated for them.
These items allow combo boxes to remember a value and its description.
Returns a string that represents the current object.
A string that represents the current object.
2
This editor shows and auto completes values from the given listview column.
Create an AutoCompleteCellEditor
This combo box is specialised to allow editing of an enum.
This editor simply shows and edits integer values.
Gets or sets the value shown by this editor
This editor simply shows and edits unsigned integer values.
This class can't be made public because unsigned int is not a
CLS-compliant type. If you want to use, just copy the code to this class
into your project and use it from there.
This editor simply shows and edits boolean values.
This editor simply shows and edits boolean values using a checkbox
Gets or sets the value shown by this editor
Gets or sets how the checkbox will be aligned
This editor simply shows and edits floating point values.
You can intercept the CellEditStarting event if you want
to change the characteristics of the editor. For example, by increasing
the number of decimal places.
Gets or sets the value shown by this editor
A delegate that creates an editor for the given value
The model from which that value came
The column for which the editor is being created
A representative value of the type to be edited. This value may not be the exact
value for the column/model combination. It could be simply representative of
the appropriate type of value.
A control which can edit the given value
An editor registry gives a way to decide what cell editor should be used to edit
the value of a cell. Programmers can register non-standard types and the control that
should be used to edit instances of that type.
All ObjectListViews share the same editor registry.
Create an EditorRegistry
Register that values of 'type' should be edited by instances of 'controlType'.
The type of value to be edited
The type of the Control that will edit values of 'type'
ObjectListView.EditorRegistry.Register(typeof(Color), typeof(MySpecialColorEditor));
Register the given delegate so that it is called to create editors
for values of the given type
The type of value to be edited
The delegate that will create a control that can edit values of 'type'
ObjectListView.EditorRegistry.Register(typeof(Color), CreateColorEditor);
...
public Control CreateColorEditor(Object model, OLVColumn column, Object value)
{
return new MySpecialColorEditor();
}
Register a delegate that will be called to create an editor for values
that have not been handled.
The delegate that will create a editor for all other types
Register a delegate that will be given a chance to create a control
before any other option is considered.
The delegate that will create a control
Remove the registered handler for the given type
Does nothing if the given type doesn't exist
The type whose registration is to be removed
Create and return an editor that is appropriate for the given value.
Return null if no appropriate editor can be found.
The model involved
The column to be edited
The value to be edited. This value may not be the exact
value for the column/model combination. It could be simply representative of
the appropriate type of value.
A Control that can edit the given type of values
Create and return an editor that will edit values of the given type
A enum type
A DataListView is a ListView that can be bound to a datasource (which would normally be a DataTable or DataView).
This listview keeps itself in sync with its source datatable by listening for change events.
The DataListView will automatically create columns to show all of the data source's columns/properties, if there is not already
a column showing that property. This allows you to define one or two columns in the designer and then have the others generated automatically.
If you don't want any column to be auto generated, set to false.
These generated columns will be only the simplest view of the world, and would look more interesting with a few delegates installed.
This listview will also automatically generate missing aspect getters to fetch the values from the data view.
Changing data sources is possible, but error prone. Before changing data sources, the programmer is responsible for modifying/resetting
the column collection to be valid for the new data source.
Internally, a CurrencyManager controls keeping the data source in-sync with other users of the data source (as per normal .NET
behavior). This means that the model objects in the DataListView are DataRowView objects. If you write your own AspectGetters/Setters,
they will be given DataRowView objects.
Make a DataListView
Add the given collection of model objects to this control.
A collection of model objects
This is a no-op for data lists, since the data
is controlled by the DataSource. Manipulate the data source
rather than this view of the data source.
Insert the given collection of objects before the given position
Where to insert the objects
The objects to be inserted
This is a no-op for data lists, since the data
is controlled by the DataSource. Manipulate the data source
rather than this view of the data source.
Remove the given collection of model objects from this control.
This is a no-op for data lists, since the data
is controlled by the DataSource. Manipulate the data source
rather than this view of the data source.
Change the Unfreeze behaviour
Handles parent binding context changes
Unused EventArgs.
Gets or sets whether or not columns will be automatically generated to show the
columns when the DataSource is set.
This must be set before the DataSource is set. It has no effect afterwards.
Get or set the DataSource that will be displayed in this list view.
The DataSource should implement either , ,
or . Some common examples are the following types of objects:
When binding to a list container (i.e. one that implements the
interface, such as )
you must also set the property in order
to identify which particular list you would like to display. You
may also set the property even when
DataSource refers to a list, since can
also be used to navigate relations between lists.
When a DataSource is set, the control will create OLVColumns to show any
data source columns that are not already shown.
If the DataSource is changed, you will have to remove any previously
created columns, since they will be configured for the previous DataSource.
.
Gets or sets the name of the list or table in the data source for which the DataListView is displaying data.
If the data source is not a DataSet or DataViewManager, this property has no effect
Gets or sets the DataSourceAdaptor that does the bulk of the work needed
for data binding.
Adaptors cannot be shared between controls. Each DataListView needs its own adapter.
A decoration is an overlay that draws itself in relation to a given row or cell.
Decorations scroll when the listview scrolls.
The interface for an object which can draw itself over the top of
an ObjectListView.
Draw this overlay
The ObjectListView that is being overlaid
The Graphics onto the given OLV
The content area of the OLV
Gets or sets the row that is to be decorated
Gets or sets the subitem that is to be decorated
An AbstractDecoration is a safe do-nothing implementation of the IDecoration interface
Draw the decoration
Gets or sets the row that is to be decorated
Gets or sets the subitem that is to be decorated
Gets the bounds of the decorations row
Get the bounds of the decorations cell
This decoration draws a slight tint over a column of the
owning listview. If no column is explicitly set, the selected
column in the listview will be used.
The selected column is normally the sort column, but does not have to be.
Create a TintedColumnDecoration
Create a TintedColumnDecoration
Draw a slight colouring over our tinted column
This overlay only works when:
- the list is in Details view
- there is at least one row
- there is a selected column (or a specified tint column)
Gets or sets the column that will be tinted
Gets or sets the color that will be 'tinted' over the selected column
This decoration draws an optionally filled border around a rectangle.
Subclasses must override CalculateBounds().
Create a BorderDecoration
Create a BorderDecoration
The pen used to draw the border
Create a BorderDecoration
The pen used to draw the border
The brush used to fill the rectangle
Draw a filled border
Subclasses should override this to say where the border should be drawn
Do the actual work of drawing the filled border
Create a GraphicsPath that represents a round cornered rectangle.
If this is 0 or less, the rectangle will not be rounded.
Gets or sets the pen that will be used to draw the border
Gets or sets the padding that will be added to the bounds of the item
before drawing the border and fill.
How rounded should the corners of the border be? 0 means no rounding.
If this value is too large, the edges of the border will appear odd.
Gets or sets the brush that will be used to fill the border
This value is ignored when using gradient brush
Gets or sets the color that will be used as the start of a gradient fill.
This and FillGradientTo must be given value to show a gradient
Gets or sets the color that will be used as the end of a gradient fill.
This and FillGradientFrom must be given value to show a gradient
Gets or sets the fill mode that will be used for the gradient.
Instances of this class draw a border around the decorated row
Calculate the boundaries of the border
Gets or sets the index of the left most column to be used for the border
Gets or sets the index of the right most column to be used for the border
Instances of this class draw a border around the decorated subitem.
Calculate the boundaries of the border
This decoration puts a border around the cell being edited and
optionally "lightboxes" the cell (makes the rest of the control dark).
Create a EditingCellBorderDecoration
Create a EditingCellBorderDecoration
Should the decoration use a lighbox display style?
Draw the decoration
Gets or set whether the decoration should make the rest of
the control dark when a cell is being edited
If this is true, FillBrush is used to overpaint
the control.
This decoration causes everything *except* the row under the mouse to be overpainted
with a tint, making the row under the mouse stand out in comparison.
The darker and more opaque the fill color, the more obvious the
decorated row becomes.
Create a LightBoxDecoration
Draw a tint over everything in the ObjectListView except the
row under the mouse.
Instances of this class put an Image over the row/cell that it is decorating
Create an image decoration
Create an image decoration
Create an image decoration
Create an image decoration
Create an image decoration
Draw this decoration
The ObjectListView being decorated
The Graphics used for drawing
The bounds of the rendering
Gets or sets the item being decorated
Gets or sets the sub item being decorated
Instances of this class draw some text over the row/cell that they are decorating
Create a TextDecoration
Create a TextDecoration
Create a TextDecoration
Create a TextDecoration
Create a TextDecoration
Draw this decoration
The ObjectListView being decorated
The Graphics used for drawing
The bounds of the rendering
Gets or sets the item being decorated
Gets or sets the sub item being decorated
An IDragSource controls how drag out from the ObjectListView will behave
A drag operation is beginning. Return the data object that will be used
for data transfer. Return null to prevent the drag from starting. The data
object will normally include all the selected objects.
The returned object is later passed to the GetAllowedEffect() and EndDrag()
methods.
What ObjectListView is being dragged from.
Which mouse button is down?
What item was directly dragged by the user? There may be more than just this
item selected.
The data object that will be used for data transfer. This will often be a subclass
of DataObject, but does not need to be.
What operations are possible for this drag? This controls the icon shown during the drag
The data object returned by StartDrag()
A combination of DragDropEffects flags
The drag operation is complete. Do whatever is necessary to complete the action.
The data object returned by StartDrag()
The value returned from GetAllowedEffects()
A do-nothing implementation of IDragSource that can be safely subclassed.
See IDragSource documentation
See IDragSource documentation
See IDragSource documentation
A reasonable implementation of IDragSource that provides normal
drag source functionality. It creates a data object that supports
inter-application dragging of text and HTML representation of
the dragged rows. It can optionally force a refresh of all dragged
rows when the drag is complete.
Subclasses can override GetDataObject() to add new
data formats to the data transfer object.
Construct a SimpleDragSource
Construct a SimpleDragSource that refreshes the dragged rows when
the drag is complete
Create a DataObject when the user does a left mouse drag operation.
See IDragSource for further information.
Which operations are allowed in the operation? By default, all operations are supported.
All opertions are supported
The drag operation is finished. Refreshe the dragged rows if so configured.
Create a data object that will be used to as the data object
for the drag operation.
Subclasses can override this method add new formats to the data object.
The ObjectListView that is the source of the drag
A data object for the drag
Gets or sets whether the dragged rows should be refreshed when the
drag operation is complete.
Objects that implement this interface can acts as the receiver for drop
operation for an ObjectListView.
Draw any feedback that is appropriate to the current drop state.
Any drawing is done over the top of the ListView. This operation should disturb
the Graphic as little as possible. Specifically, do not erase the area into which
you draw.
A Graphic for drawing
The contents bounds of the ListView (not including any header)
The user has released the drop over this control
Implementators should set args.Effect to the appropriate DragDropEffects. This value is returned
to the originator of the drag.
A drag has entered this control.
Implementators should set args.Effect to the appropriate DragDropEffects.
Change the cursor to reflect the current drag operation.
The drag has left the bounds of this control
The drag is moving over this control.
This is where any drop target should be calculated.
Implementators should set args.Effect to the appropriate DragDropEffects.
Should the drag be allowed to continue?
Gets or sets the ObjectListView that is the drop sink
This is a do-nothing implementation of IDropSink that is a useful
base class for more sophisticated implementations.
Draw any feedback that is appropriate to the current drop state.
Any drawing is done over the top of the ListView. This operation should disturb
the Graphic as little as possible. Specifically, do not erase the area into which
you draw.
A Graphic for drawing
The contents bounds of the ListView (not including any header)
The user has released the drop over this control
Implementators should set args.Effect to the appropriate DragDropEffects. This value is returned
to the originator of the drag.
A drag has entered this control.
Implementators should set args.Effect to the appropriate DragDropEffects.
The drag has left the bounds of this control
The drag is moving over this control.
This is where any drop target should be calculated.
Implementators should set args.Effect to the appropriate DragDropEffects.
Change the cursor to reflect the current drag operation.
You only need to override this if you want non-standard cursors.
The standard cursors are supplied automatically.
Should the drag be allowed to continue?
You only need to override this if you want the user to be able
to end the drop in some non-standard way, e.g. dragging to a
certain point even without releasing the mouse, or going outside
the bounds of the application.
This is called when the mouse leaves the drop region and after the
drop has completed.
Gets or sets the ObjectListView that is the drop sink
The enum indicates which target has been found for a drop operation
No applicable target has been found
The list itself is the target of the drop
An item is the target
Between two items (or above the top item or below the bottom item)
can be the target. This is not actually ever a target, only a value indicate
that it is valid to drop between items
Above an item is the target
Below an item is the target
A subitem is the target of the drop
On the right of an item is the target (not currently used)
On the left of an item is the target (not currently used)
This class represents a simple implementation of a drop sink.
Actually, it should be called CleverDropSink -- it's far from simple and can do quite a lot in its own right.
Make a new drop sink
Cleanup the drop sink when the mouse has left the control or
the drag has finished.
Draw any feedback that is appropriate to the current drop state.
Any drawing is done over the top of the ListView. This operation should disturb
the Graphic as little as possible. Specifically, do not erase the area into which
you draw.
A Graphic for drawing
The contents bounds of the ListView (not including any header)
The user has released the drop over this control
A drag has entered this control.
Implementators should set args.Effect to the appropriate DragDropEffects.
Change the cursor to reflect the current drag operation.
The drag is moving over this control.
Trigger the Dropped events
Trigger CanDrop
Trigger Dropped
Trigger ModelCanDrop
Trigger ModelDropped
Handle the timer tick event, which is sent when the listview should
scroll
When the mouse is at the given point, what should the target of the drop be?
This method should update the DropTarget* members of the given arg block
The mouse point, in client co-ordinates
What sort of action is possible when the mouse is at the given point?
Based solely on the state of the modifier keys, what drop operation should
be used?
The drop operation that matches the state of the keys
Should the listview be made to scroll when the mouse is at the given point?
Update the state of our sink to reflect the information that
may have been written into the drop event args.
Draw the feedback that shows that the background is the target
Draw the feedback that shows that an item (or a subitem) is the target
DropTargetItem and DropTargetSubItemIndex tells what is the target
Draw the feedback that shows the drop will occur before target
Draw the feedback that shows the drop will occur after target
Return a GraphicPath that is round corner rectangle.
Calculate the target rectangle when the given item (and possible subitem)
is the target of the drop.
Draw a "between items" line at the given co-ordinates
Get or set the locations where a drop is allowed to occur (OR-ed together)
Gets or sets whether this sink allows model objects to be dragged from other lists. Defaults to true.
Gets or sets whether the ObjectListView should scroll when the user drags
something near to the top or bottom rows. Defaults to true.
AutoScroll does not scroll horizontally.
Gets the billboard overlay that will be used to display feedback
messages during a drag operation.
Set this to null to stop the feedback.
Get or set whether a drop can occur between items of the list
Get or set whether a drop can occur on the listview itself
Get or set whether a drop can occur on items in the list
Get or set whether a drop can occur on a subitem in the list
Gets or sets whether the drop sink should draw feedback onto the given list
during the drag operation. Defaults to true.
If this is false, you will have to give the user feedback in some
other fashion, like cursor changes
Get or set the index of the item that is the target of the drop
Get the item that is the target of the drop
Get or set the location of the target of the drop
Get or set the index of the subitem that is the target of the drop
Get or set the color that will be used to provide drop feedback
Get whether the alt key was down during this drop event
Get whether any modifier key was down during this drop event
Get whether the control key was down during this drop event
Get whether the left mouse button was down during this drop event
Get whether the right mouse button was down during this drop event
Get whether the right mouse button was down during this drop event
Get whether the shift key was down during this drop event
Get or set the state of the keys during this drop event
Gets or sets whether the drop sink will automatically use cursors
based on the drop effect. By default, this is true. If this is
set to false, you must set the Cursor yourself.
Triggered when the sink needs to know if a drop can occur.
Handlers should set Effect to indicate what is possible.
Handlers can change any of the DropTarget* setttings to change
the target of the drop.
Triggered when the drop is made.
Triggered when the sink needs to know if a drop can occur
AND the source is an ObjectListView
Handlers should set Effect to indicate what is possible.
Handlers can change any of the DropTarget* setttings to change
the target of the drop.
Triggered when the drop is made.
AND the source is an ObjectListView
This drop sink allows items within the same list to be rearranged,
as well as allowing items to be dropped from other lists.
This class can only be used on plain ObjectListViews and FastObjectListViews.
The other flavours have no way to implement the insert operation that is required.
This class does not work with grouping.
This class works when the OLV is sorted, but it is up to the programmer
to decide what rearranging such lists "means". Example: if the control is sorting
students by academic grade, and the user drags a "Fail" grade student up amonst the "A+"
students, it is the responsibility of the programmer to makes the appropriate changes
to the model and redraw/rebuild the control so that the users action makes sense.
Users of this class should listen for the CanDrop event to decide
if models from another OLV can be moved to OLV under this sink.
Create a RearrangingDropSink
Create a RearrangingDropSink
Trigger OnModelCanDrop
Trigger OnModelDropped
Do the work of processing the dropped items
When a drop sink needs to know if something can be dropped, or
to notify that a drop has occured, it uses an instance of this class.
Create a OlvDropEventArgs
Get the original drag-drop event args
Get the data object that is being dragged
Get the drop sink that originated this event
Get or set the index of the item that is the target of the drop
Get or set the location of the target of the drop
Get or set the index of the subitem that is the target of the drop
Get the item that is the target of the drop
Get or set the drag effect that should be used for this operation
Get or set if this event was handled. No further processing will be done for a handled event.
Get or set the feedback message for this operation
If this is not null, it will be displayed as a feedback message
during the drag.
Get the ObjectListView that is being dropped on
Get the location of the mouse (in target ListView co-ords)
Get the drop action indicated solely by the state of the modifier keys
These events are triggered when the drag source is an ObjectListView.
Create a ModelDropEventArgs
Refresh all the objects involved in the operation
Gets the model objects that are being dragged.
Gets the ObjectListView that is the source of the dragged objects.
Get the model object that is being dropped upon.
This is only value for TargetLocation == Item
The callbacks for CellEditing events
this
We could replace this with EventHandler<CellEditEventArgs> but that would break all
cell editing event code from v1.x.
Let the world know that a cell edit operation is beginning or ending
Create an event args
Change this to true to cancel the cell editing operation.
During the CellEditStarting event, setting this to true will prevent the cell from being edited.
During the CellEditFinishing event, if this value is already true, this indicates that the user has
cancelled the edit operation and that the handler should perform cleanup only. Setting this to true,
will prevent the ObjectListView from trying to write the new value into the model object.
During the CellEditStarting event, this can be modified to be the control that you want
to edit the value. You must fully configure the control before returning from the event,
including its bounds and the value it is showing.
During the CellEditFinishing event, you can use this to get the value that the user
entered and commit that value to the model. Changing the control during the finishing
event has no effect.
The column of the cell that is going to be or has been edited.
The model object of the row of the cell that is going to be or has been edited.
The listview item of the cell that is going to be or has been edited.
The data value of the cell as it stands in the control.
Only validate during Validating and Finishing events.
The index of the cell that is going to be or has been edited.
The data value of the cell before the edit operation began.
The bounds of the cell that is going to be or has been edited.
Gets or sets whether the control used for editing should be auto matically disposed
when the cell edit operation finishes. Defaults to true
If the control is expensive to create, you might want to cache it and reuse for
for various cells. If so, you don't want ObjectListView to dispose of the control automatically
Event blocks for events that can be cancelled
Has this event been cancelled by the event handler?
BeforeSorting
Create BeforeSortingEventArgs
Create BeforeSortingEventArgs
Did the event handler already do the sorting for us?
What column will be used for grouping
How will groups be ordered
What column will be used for sorting
What order will be used for sorting. None means no sorting.
What column will be used for secondary sorting?
What order will be used for secondary sorting?
Sorting has just occurred.
Create a AfterSortingEventArgs
Create a AfterSortingEventArgs
What column was used for grouping?
What ordering was used for grouping?
What column was used for sorting?
What ordering was used for sorting?
What column was used for secondary sorting?
What order was used for secondary sorting?
This event is triggered when the contents of a list have changed
and we want the world to have a chance to filter the list.
Create a FilterEventArgs
Gets or sets what objects are being filtered
Gets or sets what objects survived the filtering
This event is triggered after the items in the list have been changed,
either through SetObjects, AddObjects or RemoveObjects.
Create a ItemsChangedEventArgs
Constructor for this event when used by a virtual list
Gets how many items were in the list before it changed
Gets how many objects are in the list after the change.
This event is triggered by AddObjects before any change has been made to the list.
Create an ItemsAddingEventArgs
Create an ItemsAddingEventArgs
Gets or sets where the collection is going to be inserted.
Gets or sets the objects to be added to the list
This event is triggered by SetObjects before any change has been made to the list.
When used with a virtual list, OldObjects will always be null.
Create ItemsChangingEventArgs
Gets or sets the objects that will be in the list after it changes.
Gets the objects that were in the list before it change.
For virtual lists, this will always be null.
This event is triggered by RemoveObjects before any change has been made to the list.
Create an ItemsRemovingEventArgs
Gets or sets the objects that will be removed
Triggered after the user types into a list
Create an AfterSearchingEventArgs
Gets or sets whether an the event handler already handled this event
Gets the string that was actually searched for
Gets the index of the row that was selected by the search.
-1 means that no row was matched
Triggered when the user types into a list
Create BeforeSearchingEventArgs
Gets or sets the string that will be found by the search routine
Modifying this value does not modify the memory of what the user has typed.
When the user next presses a character, the search string will revert to what
the user has actually typed.
Gets or sets the index of the first row that will be considered to matching.
The parameter block when telling the world about a cell based event
Gets or set if this event completelely handled. If it was, no further processing
will be done for it.
Gets the ObjectListView that is the source of the event
Gets the model object under the cell
This is null for events triggered by the header.
Gets the row index of the cell
This is -1 for events triggered by the header.
Gets the column index of the cell
This is -1 when the view is not in details view.
Gets the column of the cell
This is null when the view is not in details view.
Gets the location of the mouse at the time of the event
Gets the state of the modifier keys at the time of the event
Gets the item of the cell
Gets the subitem of the cell
This is null when the view is not in details view and
for event triggered by the header
Gets the HitTest object that determined which cell was hit
Tells the world that a cell was clicked
Gets or sets the number of clicks associated with this event
Tells the world that a cell was right clicked
Gets or sets the menu that should be displayed as a result of this event.
The menu will be positioned at Location, so changing that property changes
where the menu will be displayed.
Tell the world that the mouse is over a given cell
Tells the world that the frozen-ness of the ObjectListView has changed.
Make a FreezeEventArgs
How frozen is the control? 0 means that the control is unfrozen,
more than 0 indicates froze.
The parameter block when telling the world that a tool tip is about to be shown.
Gets or sets the text should be shown on the tooltip for this event
Setting this to empty or null prevents any tooltip from showing
In what direction should the text for this tooltip be drawn?
Should the tooltip for this event been shown in bubble style?
This doesn't work reliable under Vista
What color should be used for the background of the tooltip
Setting this does nothing under Vista
What color should be used for the foreground of the tooltip
Setting this does nothing under Vista
What string should be used as the title for the tooltip for this event?
Which standard icon should be used for the tooltip for this event
How many milliseconds should the tooltip remain before it automatically
disappears.
What font should be used to draw the text of the tooltip?
Gets the tooltip control that is triggering the tooltip event
Common information to all hyperlink events
Gets the ObjectListView that is the source of the event
Gets the model object under the cell
Gets the row index of the cell
Gets the column index of the cell
This is -1 when the view is not in details view.
Gets the column of the cell
This is null when the view is not in details view.
Gets the item of the cell
Gets the subitem of the cell
This is null when the view is not in details view
Gets the ObjectListView that is the source of the event
Gets or set if this event completelely handled. If it was, no further processing
will be done for it.
Gets or sets the url that should be invoked when this cell is clicked.
Setting this to None or String.Empty means that this cell is not a hyperlink
Gets the ObjectListView that is the source of the event
Gets the model object under the cell
Gets the column of the cell
This is null when the view is not in details view.
Gets the text of the cell
Gets or sets whether or not this cell is a hyperlink.
Defaults to true for enabled rows and false for disabled rows.
Gets the ObjectListView that is the source of the event
Gets the item of the cell
Gets the model object under the cell
Gets the row index of the cell
Gets the display index of the row
Should events be triggered for each cell in this row?
Parameter block for FormatCellEvent
Gets the column index of the cell
This is -1 when the view is not in details view.
Gets the column of the cell
This is null when the view is not in details view.
Gets the subitem of the cell
This is null when the view is not in details view
Gets the model value that is being displayed by the cell.
This is null when the view is not in details view
The event args when a hyperlink is clicked
Gets the url that was associated with this cell.
The event args when the check box in a column header is changing
Get the column whose checkbox is changing
Get or set the new state that should be used by the column
The event args when the hot item changed
Returns a string that represents the current object.
A string that represents the current object.
2
Gets or set if this event completelely handled. If it was, no further processing
will be done for it.
Gets the part of the cell that the mouse is over
Gets an extended indication of the part of item/subitem/group that the mouse is currently over
Gets the index of the column that the mouse is over
In non-details view, this will always be 0.
Gets the index of the row that the mouse is over
Gets the group that the mouse is over
Gets the part of the cell that the mouse used to be over
Gets an extended indication of the part of item/subitem/group that the mouse used to be over
Gets the index of the column that the mouse used to be over
Gets the index of the row that the mouse used to be over
Gets the group that the mouse used to be over
Let the world know that a checkbox on a subitem is changing
Create a new event block
The column of the cell that is having its checkbox changed.
The model object of the row of the cell that is having its checkbox changed.
The listview item of the cell that is having its checkbox changed.
The current check state of the cell.
The proposed new check state of the cell.
The index of the cell that is going to be or has been edited.
This event argument block is used when groups are created for a list.
Create a CreateGroupsEventArgs
Gets the settings that control the creation of groups
Gets or sets the groups that should be used
Has this event been cancelled by the event handler?
This event argument block is used when the text of a group task is clicked
Create a GroupTaskClickedEventArgs
Gets which group was clicked
This event argument block is used when a group is about to expand or collapse
Create a GroupExpandingCollapsingEventArgs
Gets which group is expanding/collapsing
Gets whether this event is going to expand the group.
If this is false, the group must be collapsing.
This event argument block is used when the state of group has changed (collapsed, selected)
Create a GroupStateChangedEventArgs
Gets whether the group was collapsed by this event
Gets whether the group was focused by this event
Gets whether the group was selected by this event
Gets whether the group was uncollapsed by this event
Gets whether the group was unfocused by this event
Gets whether the group was unselected by this event
Gets which group had its state changed
Gets the previous state of the group
Gets the new state of the group
This event argument block is used when a branch of a tree is about to be expanded
Create a new event args
Gets the model that is about to expand. If null, all branches are going to be expanded.
Gets the OLVListItem that is about to be expanded
This event argument block is used when a branch of a tree has just been expanded
Create a new event args
Gets the model that is was expanded. If null, all branches were expanded.
Gets the OLVListItem that was expanded
This event argument block is used when a branch of a tree is about to be collapsed
Create a new event args
Gets the model that is about to collapse. If this is null, all models are going to collapse.
Gets the OLVListItem that is about to be collapsed. Can be null
This event argument block is used when a branch of a tree has just been collapsed
Create a new event args
Gets the model that is was collapsed. If null, all branches were collapsed
Gets the OLVListItem that was collapsed
A FastDataListView virtualizes the display of data from a DataSource. It operates on
DataSets and DataTables in the same way as a DataListView, but does so much more efficiently.
A FastDataListView still has to load all its data from the DataSource. If you have SQL statement
that returns 1 million rows, all 1 million rows will still need to read from the database.
However, once the rows are loaded, the FastDataListView will only build rows as they are displayed.
A FastObjectListView trades function for speed.
On my mid-range laptop, this view builds a list of 10,000 objects in 0.1 seconds,
as opposed to a normal ObjectListView which takes 10-15 seconds. Lists of up to 50,000 items should be
able to be handled with sub-second response times even on low end machines.
A FastObjectListView is implemented as a virtual list with many of the virtual modes limits (e.g. no sorting)
fixed through coding. There are some functions that simply cannot be provided. Specifically, a FastObjectListView cannot:
- use Tile view
- show groups on XP
Make a FastObjectListView
Move the given collection of objects to the given index.
This operation only makes sense on non-grouped ObjectListViews.
Remove any sorting and revert to the given order of the model objects
To be really honest, Unsort() doesn't work on FastObjectListViews since
the original ordering of model objects is lost when Sort() is called. So this method
effectively just turns off sorting.
Gets the collection of objects that survive any filtering that may be in place.
Get/set the collection of objects that this list will show
The contents of the control will be updated immediately after setting this property.
This method preserves selection, if possible. Use SetObjects() if
you do not want to preserve the selection. Preserving selection is the slowest part of this
code and performance is O(n) where n is the number of selected rows.
This method is not thread safe.
Create the DataSourceAdapter that this control will use.
A DataSourceAdapter configured for this list
Subclasses should override this to create their
own specialized adapters
Change the Unfreeze behaviour
Gets or sets whether or not columns will be automatically generated to show the
columns when the DataSource is set.
This must be set before the DataSource is set. It has no effect afterwards.
Get or set the VirtualListDataSource that will be displayed in this list view.
The VirtualListDataSource should implement either , ,
or . Some common examples are the following types of objects:
When binding to a list container (i.e. one that implements the
interface, such as )
you must also set the property in order
to identify which particular list you would like to display. You
may also set the property even when
VirtualListDataSource refers to a list, since can
also be used to navigate relations between lists.
Gets or sets the name of the list or table in the data source for which the DataListView is displaying data.
If the data source is not a DataSet or DataViewManager, this property has no effect
Gets or sets the DataSourceAdaptor that does the bulk of the work needed
for data binding.
Concrete implementation of the ICluster interface.
A cluster is a like collection of objects that can be usefully filtered
as whole using the filtering UI provided by the ObjectListView.
Gets or sets how many items belong to this cluster
Gets or sets the label that will be shown to the user to represent
this cluster
Gets or sets the actual data object that all members of this cluster
have commonly returned.
Create a cluster
The key for the cluster
Return a string representation of this cluster
Return an indication of the ordering between this object and the given one
Gets or sets how many items belong to this cluster
Gets or sets the label that will be shown to the user to represent
this cluster
Gets or sets the actual data object that all members of this cluster
have commonly returned.
This class calculates clusters from the groups that the column uses.
This is the default strategy for all non-date, filterable columns.
This class does not strictly mimic the groups created by the given column.
In particular, if the programmer changes the default grouping technique
by listening for grouping events, this class will not mimic that behaviour.
Get the cluster key by which the given model will be partitioned by this strategy
Gets the display label that the given cluster should use
Provide a data source for a FastObjectListView
This class isn't intended to be used directly, but it is left as a public
class just in case someone wants to subclass it.
A do-nothing implementation of the VirtualListDataSource interface.
Creates an AbstractVirtualListDataSource
The list view that this data source is giving information to.
Update/replace the nth object with the given object
This is a useful default implementation of SearchText method, intended to be called
by implementors of IVirtualListDataSource.
Create a FastObjectListDataSource
Get n'th object
How many items are in the data source
Get the index of the given model
Remove the given collection of models from this source.
Update/replace the nth object with the given object
Apply the given filters to this data source. One or both may be null.
Rebuild the map that remembers which model object is displayed at which line
Build our filtered list from our full list.
Gets the full list of objects being used for this fast list.
This list is unfiltered.
Gets the list of objects from ObjectList which survive any installed filters.
Instances of this class know how to build a Filter menu.
It is responsible for clustering the values in the target column,
build a menu that shows those clusters, and then constructing
a filter that will enact the users choices.
Almost all of the methods in this class are declared as "virtual protected"
so that subclasses can provide alternative behaviours.
Gets or sets the string that labels the Apply button.
Exposed so it can be localized.
Gets or sets the string that labels the Clear All menu item.
Exposed so it can be localized.
Gets or sets the string that labels the Filtering menu as a whole..
Exposed so it can be localized.
Gets or sets the string that represents Select All values.
If this is set to null or empty, no Select All option will be included.
Exposed so it can be localized.
Gets or sets the image that will be placed next to the Clear Filtering menu item
Gets or sets the image that will be placed next to all "Apply" menu items on the filtering menu
Create a Filter menu on the given tool tip for the given column in the given ObjectListView.
This is the main entry point into this class.
The strip that should be shown to the user
Create a collection of clusters that should be presented to the user
Order the given list of clusters in the manner in which they should be presented to the user.
Do the work of making a menu that shows the clusters to the users
Wrap a protected section around the real HandleItemChecked method, so that if
that method tries to change a "checkedness" of an item, we don't get a recursive
stack error. Effectively, this ensure that HandleItemChecked is only called
in response to a user action.
Handle a user-generated ItemCheck event
Handle any checking/unchecking of the Select All option, and keep
its checkedness in sync with everything else that is checked.
Clear all the filters that are applied to the given column
The column from which filters are to be removed
Apply the selected values from the given list as a filter on the given column
A list in which the checked items should be used as filters
The column for which a filter should be generated
Gets or sets whether null should be considered as a valid data value.
If this is true (the default), then a cluster will null as a key will be allow.
If this is false, object that return a cluster key of null will ignored.
Gets or sets the maximum number of objects that the clustering strategy
will consider. This should be large enough to collect all unique clusters,
but small enough to finish in a reasonable time.
The default value is 10,000. This should be perfectly
acceptable for almost all lists.
Interface for whole list filtering
Return a subset of the given list of model objects as the new
contents of the ObjectListView
The collection of model objects that the list will possibly display
The filtered collection that holds the model objects that will be displayed.
This filter calls a given Predicate to decide if a model object should be included
Create a filter based on the given predicate
The function that will filter objects
Should the given model object be included?
Gets or sets the predicate used to filter model objects
A CompositeFilter joins several other filters together.
If there are no filters, all model objects are included
Create an empty filter
Create a composite filter from the given list of filters
A list of filters
Decide whether or not the given model should be included by the filter
True if the object is included by the filter
Decide whether or not the given model should be included by the filter
Filters is guaranteed to be non-empty when this method is called
The model object under consideration
True if the object is included by the filter
Gets or sets the filters used by this composite
Get the sub filters that are text match filters
A CompositeAllFilter joins several other filters together.
A model object must satisfy all filters to be included.
If there are no filters, all model objects are included
Create a filter
Decide whether or not the given model should be included by the filter
Filters is guaranteed to be non-empty when this method is called
The model object under consideration
True if the object is included by the filter
A CompositeAllFilter joins several other filters together.
A model object must only satisfy one of the filters to be included.
If there are no filters, all model objects are included
Create a filter from the given filters
Decide whether or not the given model should be included by the filter
Filters is guaranteed to be non-empty when this method is called
The model object under consideration
True if the object is included by the filter
Instances of this class extract a value from the model object
and compare that value to a list of fixed values. The model
object is included if the extracted value is in the list
If there is no delegate installed or there are
no values to match, no model objects will be matched
Create a filter that will use the given delegate to extract values
Create a filter that will extract values using the given delegate
and compare them to the values in the given list.
Should the given model object be included?
Decides if the given property is a match for the values in the PossibleValues collection
Gets or sets the delegate that will be used to extract values
from model objects
Gets or sets the list of values that the value extracted from
the model object must match in order to be included.
Instances of this class match a property of a model objects against
a list of bit flags. The property should be an xor-ed collection
of bits flags.
Both the property compared and the list of possible values
must be convertible to ulongs.
Create an instance
Decides if the given property is a match for the values in the PossibleValues collection
Gets or sets the collection of values that will be matched.
These must be ulongs (or convertible to ulongs).
Base class for whole list filters
Return a subset of the given list of model objects as the new
contents of the ObjectListView
The collection of model objects that the list will possibly display
The filtered collection that holds the model objects that will be displayed.
Instance of this class implement delegate based whole list filtering
Create a ListFilter
Do the actual work of filtering
Gets or sets the delegate that will filter the list
A delegate that filters on a whole list
Filter the list so only the last N entries are displayed
Create a no-op tail filter
Create a filter that includes on the last N model objects
Return the last N subset of the model objects
Gets or sets the number of model objects that will be
returned from the tail of the list
Instances of this class put a CheckedListBox into a tool strip menu item.
Create a ToolStripCheckedListBox
Add a possibly checked item to the control
Add an item with the given state to the control
Gets the checkedness of the i'th item
Set the checkedness of the i'th item
Check all the items in the control
Unchecked all the items in the control
Listen for events on the underlying control
Stop listening for events on the underlying control
Trigger the ItemCheck event
Gets the control embedded in the menu
Gets the items shown in the checkedlistbox
Gets or sets whether an item should be checked when it is clicked
Gets a collection of the checked items
Tell the world that an item was checked
This form is an example of how an application could allows the user to select which columns
an ObjectListView will display, as well as select which order the columns are displayed in.
In Tile view, ColumnHeader.DisplayIndex does nothing. To reorder the columns you have
to change the order of objects in the Columns property.
Remember that the first column is special!
It has to remain the first column.
Make a new ColumnSelectionForm
Open this form so it will edit the columns that are available in the listview's current view
The ObjectListView whose columns are to be altered
Open this form so it will edit the columns that are available in the given listview
when the listview is showing the given type of view.
The ObjectListView whose columns are to be altered
The view that is to be altered. Must be View.Details or View.Tile
Initialize the form to show the columns of the given view
The user has pressed OK. Do what's requied.
Enable the controls on the dialog to match the current state
Required designer variable.
Clean up any resources being used.
true if managed resources should be disposed; otherwise, false.
Required method for Designer support - do not modify
the contents of this method with the code editor.
A Comparer that will sort a list of columns so that visible ones come before hidden ones,
and that are ordered by their display order.
An object that implements the IGenerator interface provides the ability
to dynamically create columns
for an ObjectListView based on the characteristics of a given collection
of model objects.
Generate columns into the given ObjectListView that come from the given
model object type.
The ObjectListView to modify
The model type whose attributes will be considered.
Will columns be generated for properties that are not marked with [OLVColumn].
Generate a list of OLVColumns based on the attributes of the given type
If allProperties to true, all public properties will have a matching column generated.
If allProperties is false, only properties that have a OLVColumn attribute will have a column generated.
Will columns be generated for properties that are not marked with [OLVColumn].
A collection of OLVColumns matching the attributes of Type that have OLVColumnAttributes.
The Generator class provides methods to dynamically create columns
for an ObjectListView based on the characteristics of a given collection
of model objects.
For a given type, a Generator can create columns to match the public properties
of that type. The generator can consider all public properties or only those public properties marked with
[OLVColumn] attribute.
Replace all columns of the given ObjectListView with columns generated
from the first member of the given enumerable. If the enumerable is
empty or null, the ObjectListView will be cleared.
The ObjectListView to modify
The collection whose first element will be used to generate columns.
Replace all columns of the given ObjectListView with columns generated
from the first member of the given enumerable. If the enumerable is
empty or null, the ObjectListView will be cleared.
The ObjectListView to modify
The collection whose first element will be used to generate columns.
Will columns be generated for properties that are not marked with [OLVColumn].
Generate columns into the given ObjectListView that come from the public properties of the given
model object type.
The ObjectListView to modify
The model type whose attributes will be considered.
Generate columns into the given ObjectListView that come from the public properties of the given
model object type.
The ObjectListView to modify
The model type whose attributes will be considered.
Will columns be generated for properties that are not marked with [OLVColumn].
Generate a list of OLVColumns based on the public properties of the given type
that have a OLVColumn attribute.
A collection of OLVColumns matching the attributes of Type that have OLVColumnAttributes.
Generate columns into the given ObjectListView that come from the given
model object type.
The ObjectListView to modify
The model type whose attributes will be considered.
Will columns be generated for properties that are not marked with [OLVColumn].
Generate a list of OLVColumns based on the attributes of the given type
If allProperties to true, all public properties will have a matching column generated.
If allProperties is false, only properties that have a OLVColumn attribute will have a column generated.
Will columns be generated for properties that are not marked with [OLVColumn].
A collection of OLVColumns matching the attributes of Type that have OLVColumnAttributes.
Replace all the columns in the given listview with the given list of columns.
Post process columns after creating them and adding them to the AllColumns collection.
Create a column from the given PropertyInfo and OLVColumn attribute
Make a column from the given PropertyInfo
Make a column from the given PropertyDescriptor
Create a column with all the given information
Create a column.
Convert a property name to a displayable title.
Configure the given column to show a checkbox if appropriate
If this given type has an property marked with [OLVChildren], make delegates that will
traverse that property as the children of an instance of the model
Generate CanExpand and ChildrenGetter delegates from the given property.
Gets or sets the actual generator used by the static convinence methods.
If you subclass the standard generator or implement IGenerator yourself,
you should install an instance of your subclass/implementation here.
A GlassPanelForm sits transparently over an ObjectListView to show overlays.
Attach this form to the given ObjectListView
Made the overlay panel invisible
Show the overlay panel in its correctly location
If the panel is always shown, this method does nothing.
If the panel is being resized, this method also does nothing.
Detach this glass panel from its previous ObjectListView
You should unbind the overlay panel before making any changes to the
widget hierarchy.
Handle when the form that owns the ObjectListView begins to be resized
Handle when the form that owns the ObjectListView finished to be resized
The owning form has moved. Move the overlay panel too.
The owning form is resizing. Hide our overlay panel until the resizing stops
Handle when the bound OLV changes its location. The overlay panel must
be moved too, IFF it is currently visible.
Handle when the bound OLV changes size. The overlay panel must
resize too, IFF it is currently visible.
Handle when the bound OLV is part of a TabControl and that
TabControl changes tabs. The overlay panel is hidden. The
first time the bound OLV is redrawn, the overlay panel will
be shown again.
Somewhere the parent of the bound OLV has changed. Update
our events.
Handle when the bound OLV changes its visibility.
The overlay panel should match the OLV's visibility.
Get the low-level windows flag that will be given to CreateWindow.
These values indicate what is the state of the group. These values
are taken directly from the SDK and many are not used by ObjectListView.
Normal
Collapsed
Hidden
NoHeader
Can be collapsed
Has focus
Is Selected
Is subsetted
Subset link has focus
All styles
This mask indicates which members of a LVGROUP have valid data. These values
are taken directly from the SDK and many are not used by ObjectListView.
No mask
Group has header
Group has footer
Group has state
pszSubtitle is valid
pszTask is valid
pszDescriptionTop is valid
pszDescriptionBottom is valid
iTitleImage is valid
iExtendedImage is valid
iFirstItem and cItems are valid
pszSubsetTitle is valid
readonly, cItems holds count of items in visible subset, iFirstItem is valid
This mask indicates which members of a GROUPMETRICS structure are valid
Instances of this class enhance the capabilities of a normal ListViewGroup,
enabling the functionality that was released in v6 of the common controls.
In this implementation (2009-09), these objects are essentially passive.
Setting properties does not automatically change the associated group in
the listview. Collapsed and Collapsible are two exceptions to this and
give immediate results.
This really should be a subclass of ListViewGroup, but that class is
sealed (why is that?). So this class provides the same interface as a
ListViewGroup, plus many other new properties.
Create an OLVGroup
Create a group with the given title
Title of the group
Calculate the index into the group image list of the given image selector
Convert this object to a string representation
Insert a native group into the underlying Windows control,
*without* using a ListViewGroup
This is used when creating virtual groups
Insert a native group into the underlying control via a ListViewGroup
Change the members of the group to match the current contents of Items,
using a ListViewGroup
Create a native LVGROUP structure that matches this group
Get the current state of this group from the underlying control
Get the current state of this group from the underlying control
Gets or sets the bottom description of the group
Descriptions only appear when group is centered and there is a title image
Gets or sets whether or not this group is collapsed
Gets or sets whether or not this group can be collapsed
Gets or sets some representation of the contents of this group
This is user defined (like Tag)
Gets whether this group has been created.
Gets or sets the int or string that will select the extended image to be shown against the title
Gets or sets the footer of the group
Gets the internal id of our associated ListViewGroup.
Gets or sets the header of the group
Gets or sets the horizontal alignment of the group header
Gets or sets the internally created id of the group
Gets or sets ListViewItems that are members of this group
Listener of the BeforeCreatingGroups event can populate this collection.
It is only used on non-virtual lists.
Gets or sets the key that was used to partition objects into this group
This is user defined (like Tag)
Gets the ObjectListView that this group belongs to
If this is null, the group has not yet been created.
Gets or sets the name of the group
As of 2009-09-01, this property is not used.
Gets or sets whether this group is focused
Gets or sets whether this group is selected
Gets or sets the text that will show that this group is subsetted
As of WinSDK v7.0, subsetting of group is officially unimplemented.
We can get around this using undocumented interfaces and may do so.
Gets or set the subtitleof the task
Gets or sets the value by which this group will be sorted.
Gets or sets the state of the group
Gets or sets which bits of State are valid
Gets or sets whether this group is showing only a subset of its elements
As of WinSDK v7.0, this property officially does nothing.
Gets or sets the user-defined data attached to this group
Gets or sets the task of this group
This task is the clickable text that appears on the right margin
of the group header.
Gets or sets the int or string that will select the image to be shown against the title
Gets or sets the top description of the group
Descriptions only appear when group is centered and there is a title image
Gets or sets the number of items that are within this group.
This should only be used for virtual groups.
Gets or sets the ListViewGroup that is shadowed by this group.
For virtual groups, this will always be null.
Class used to capture window messages for the header of the list view
control.
Create a header control for the given ObjectListView.
Gets the index of the column under the cursor if the cursor is over it's checkbox
Return true if the given point is over the checkbox for the given column.
Calculate how height the header needs to be
Height in pixels
Get the bounds of the checkbox against the given column
Should the given column be drawn with a checkbox against it?
Should the given column show a sort indicator?
Should the given column be drawn with a filter indicator against it?
Should the given column show a non-themed sort indicator?
Return the bounds of the item with the given index
Return the bounds within which the given column will be drawn
Force the header to redraw by invalidating it
Force the header to redraw a single column by invalidating it
Create a native tool tip control for this listview
Override the basic message pump
Handle the LButtonDown windows message
Handle the LButtonUp windows message
Handle the SetCursor windows message
Handle the MouseMove windows message
Handle the MouseLeave windows message
Handle the Notify windows message
Handle the CustomDraw windows message
The message divides a ListView's space between the header and the rows of the listview.
The WINDOWPOS structure controls the headers bounds, the RECT controls the listview bounds.
Handle when the underlying header control is destroyed
Does this header need to be custom drawn?
Word wrapping and colored text require custom drawning. Funnily enough, we
can change the font natively.
Draw one cell of the header
Draw a background for the header, without using Themes.
Draw a more-or-less pure themed header background.
Draw a sort indicator using themes
Draw a sort indicator without using themes
Draw an indication that this column has a filter applied to it
Draw the header's image and text
Return the header format that should be used for the given column
What style should be applied to the header?
What font should be used to draw the header text?
Perform a HitTest for the header control
Null if the given point isn't over the header
Return the index of the column under the current cursor position,
or -1 if the cursor is not over a column
Index of the column under the cursor, or -1
Return the Windows handle behind this control
When an ObjectListView is initialized as part of a UserControl, the
GetHeaderControl() method returns 0 until the UserControl is
completely initialized. So the AssignHandle() call in the constructor
doesn't work. So we override the Handle property so value is always
current.
Gets or sets a style that should be applied to the font of the
column's header text when the mouse is over that column
THIS IS EXPERIMENTAL. USE AT OWN RISK. August 2009
Gets the client rectangle for the header
Gets whether the cursor is over a "locked" divider, i.e.
one that cannot be dragged by the user.
Gets or sets the listview that this header belongs to
Gets the maximum height of the header. -1 means no maximum.
Gets the minimum height of the header. -1 means no minimum.
Get or set the ToolTip that shows tips for the header
Gets or sets whether the text in column headers should be word
wrapped when it is too long to fit within the column
What flags will be used when drawing text
Indicates the behavior of a key when a cell "on the edge" is being edited.
and the normal behavior of that key would exceed the edge. For example,
for a key that normally moves one column to the left, the "edge" would be
the left most column, since the normal action of the key cannot be taken
(since there are no more columns to the left).
The key press will be ignored
The key press will result in the cell editing wrapping to the
cell on the opposite edge.
The key press will wrap, but the column will be changed to the
appropiate adjacent column. This only makes sense for keys where
the normal action is ChangeRow.
The key press will wrap, but the row will be changed to the
appropiate adjacent row. This only makes sense for keys where
the normal action is ChangeColumn.
The key will result in the current edit operation being ended.
Indicates the normal behaviour of a key when used during a cell edit
operation.
The key press will be ignored
The key press will end the current edit and begin an edit
operation on the next editable cell to the left.
The key press will end the current edit and begin an edit
operation on the next editable cell to the right.
The key press will end the current edit and begin an edit
operation on the row above.
The key press will end the current edit and begin an edit
operation on the row below
The key press will cancel the current edit
The key press will finish the current edit operation
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Custom verb that can be used for specialized actions.
Instances of this class handle key presses during a cell edit operation.
Sets the behaviour of a given key
Handle a key press
True if the key was completely handled.
Setup the default key mapping
Handle the end edit command
Handle the cancel edit command
Placeholder that subclasses can override to handle any custom verbs
Handle a change row command
Handle a change column command
Start editing the indicated cell if that cell is not already being edited
The row to edit
The cell within that row to edit
Gets the adjacent item to the given item in the given direction.
If that item is disabled, continue in that direction until an enabled item is found.
The row whose neighbour is sought
The direction of the adjacentness
An OLVListView adjacent to the given item, or null if there are no more enabled items in that direction.
Gets the adjacent item to the given item in the given direction, wrapping if needed.
The row whose neighbour is sought
The direction of the adjacentness
An OLVListView adjacent to the given item, or null if there are no more items in that direction.
Gets or sets the ObjectListView on which the current key is being handled.
This cannot be null.
Gets the row of the cell that is currently being edited
Gets the index of the column of the cell that is being edited
Gets or sets the map that remembers the normal behaviour of keys
Gets or sets the map that remembers the desired behaviour of keys
on edge cases.
Gets a collection of columns that are editable in the order they are shown to the user
An instance of Munger gets a value from or puts a value into a target object. The property
to be peeked (or poked) is determined from a string. The peeking or poking is done using reflection.
Name of the aspect to be peeked can be a field, property or parameterless method. The name of an
aspect to poke can be a field, writable property or single parameter method.
Aspect names can be dotted to chain a series of references.
Order.Customer.HomeAddress.State
Create a do nothing Munger
Create a Munger that works on the given aspect name
The name of the
A helper method to put the given value into the given aspect of the given object.
This method catches and silently ignores any errors that occur
while modifying the target object
The object to be modified
The name of the property/field to be modified
The value to be assigned
Did the modification work?
Extract the value indicated by our AspectName from the given target.
If the aspect name is null or empty, this will return null.
The object that will be peeked
The value read from the target
Extract the value indicated by our AspectName from the given target, raising exceptions
if the munger fails.
If the aspect name is null or empty, this will return null.
The object that will be peeked
The value read from the target
Poke the given value into the given target indicated by our AspectName.
If the AspectName is a dotted path, all the selectors bar the last
are used to find the object that should be updated, and the last
selector is used as the property to update on that object.
So, if 'target' is a Person and the AspectName is "HomeAddress.Postcode",
this method will first fetch "HomeAddress" property, and then try to set the
"Postcode" property on the home address object.
The object that will be poked
The value that will be poked into the target
bool indicating whether the put worked
Convert a possibly dotted AspectName into a list of SimpleMungers
Evaluate the given chain of SimpleMungers against an initial target.
Gets or sets whether Mungers will silently ignore missing aspect errors.
By default, if a Munger is asked to fetch a field/property/method
that does not exist from a model, it returns an error message, since that
condition is normally a programming error. There are some use cases where
this is not an error, and the munger should simply keep quiet.
By default this is true during release builds.
The name of the aspect that is to be peeked or poked.
This name can be a field, property or parameter-less method.
The name can be dotted, which chains references. If any link in the chain returns
null, the entire chain is considered to return null.
"DateOfBirth"
"Owner.HomeAddress.Postcode"
Gets the list of SimpleMungers that match our AspectName
A SimpleMunger deals with a single property/field/method on its target.
Munger uses a chain of these resolve a dotted aspect name.
Create a SimpleMunger
Get a value from the given target
Poke the given value into the given target indicated by our AspectName.
The object that will be poked
The value that will be poked into the target
bool indicating if the put worked
The name of the aspect that is to be peeked or poked.
This name can be a field, property or method.
When using a method to get a value, the method must be parameter-less.
When using a method to set a value, the method must accept 1 parameter.
It cannot be a dotted name.
These exceptions are raised when a munger finds something it cannot process
Create a MungerException
Get the munger that raised the exception
Gets the target that threw the exception
Wrapper for all native method calls on ListView controls
Put an image under the ListView.
The ListView must have its handle created before calling this.
This doesn't work very well. Specifically, it doesn't play well with owner drawn,
and grid lines are drawn over it.
The image to be used as the background. If this is null, any existing background image will be cleared.
If this is true, the image is pinned to the bottom right and does not scroll. The other parameters are ignored
If this is true, the image will be tiled to fill the whole control background. The offset parameters will be ignored.
If both watermark and tiled are false, this indicates the horizontal percentage where the image will be placed. 0 is absolute left, 100 is absolute right.
If both watermark and tiled are false, this indicates the vertical percentage where the image will be placed.
Draws an image using the specified flags and state on XP systems.
The image list from which an item will be drawn
Device context to draw to
Index of image to draw
X Position to draw at
Y Position to draw at
Drawing flags
Width to draw
Height to draw
State flags
Make sure the ListView has the extended style that says to display subitem images.
This method must be called after any .NET call that update the extended styles
since they seem to erase this setting.
The listview to send a m to
Change the virtual list size of the given ListView (which must be in virtual mode)
This will not change the scroll position
The listview to send a message to
How many rows should the list have?
Make sure the ListView has the extended style that says to display subitem images.
This method must be called after any .NET call that update the extended styles
since they seem to erase this setting.
The listview to send a m to
Calculates the number of items that can fit vertically in the visible area of a list-view (which
must be in details or list view.
The listView
Number of visible items per page
For the given item and subitem, make it display the given image
The listview to send a m to
row number (0 based)
subitem (0 is the item itself)
index into the image list
Setup the given column of the listview to show the given image to the right of the text.
If the image index is -1, any previous image is cleared
The listview to send a m to
Index of the column to modifiy
Index into the small image list
Does this version of the operating system have builtin sort indicators?
Are there builtin sort indicators
XP and later have these
Return the bounds of the update region on the given control.
The BeginPaint() system call validates the update region, effectively wiping out this information.
So this call has to be made before the BeginPaint() call.
The control whose update region is be calculated
A rectangle
Validate an area of the given control. A validated area will not be repainted at the next redraw.
The control to be validated
The area of the control to be validated
Select all rows on the given listview
The listview whose items are to be selected
Deselect all rows on the given listview
The listview whose items are to be deselected
Deselect a single row
Set the item state on the given item
The listview whose item's state is to be changed
The index of the item to be changed
Which bits of the value are to be set?
The value to be set
Scroll the given listview by the given deltas
true if the scroll succeeded
Return the handle to the header control on the given list
The listview whose header control is to be returned
The handle to the header control
Return the edges of the given column.
A Point holding the left and right co-ords of the column.
-1 means that the sides could not be retrieved.
Return the edges of the given column.
A Point holding the left and right co-ords of the column.
-1 means that the sides could not be retrieved.
Return the index of the column of the header that is under the given point.
Return -1 if no column is under the pt
The list we are interested in
The client co-ords
The index of the column under the point, or -1 if no column header is under that point
Return the index of the divider under the given point. Return -1 if no divider is under the pt
The list we are interested in
The client co-ords
The index of the divider under the point, or -1 if no divider is under that point
Get the scroll position of the given scroll bar
Change the z-order to the window 'toBeMoved' so it appear directly on top of 'reference'
Make the given control/window a topmost window
Change the size of the window without affecting any other attributes
Show the given window without activating it
The window to show
Mark the given column as being selected.
The OLVColumn or null to clear
This method works, but it prevents subitems in the given column from having
back colors.
Flags controlling how the Image List item is
drawn
Draw item normally.
Draw item transparently.
Draw item blended with 25% of the specified foreground colour
or the Highlight colour if no foreground colour specified.
Draw item blended with 50% of the specified foreground colour
or the Highlight colour if no foreground colour specified.
Draw the icon's mask
Draw the icon image without using the mask
Draw the icon using the ROP specified.
Preserves the alpha channel in dest. XP only.
Scale the image to cx, cy instead of clipping it. XP only.
Scale the image to the current DPI of the display. XP only.
Enumeration containing XP ImageList Draw State options
The image state is not modified.
Adds a glow effect to the icon, which causes the icon to appear to glow
with a given color around the edges. (Note: does not appear to be implemented)
Adds a drop shadow effect to the icon. (Note: does not appear to be implemented)
Saturates the icon by increasing each color component
of the RGB triplet for each pixel in the icon. (Note: only ever appears to result in a completely unsaturated icon)
Alpha blends the icon. Alpha blending controls the transparency
level of an icon, according to the value of its alpha channel.
(Note: does not appear to be implemented).
ColumnComparer is the workhorse for all comparison between two values of a particular column.
If the column has a specific comparer, use that to compare the values. Otherwise, do
a case insensitive string compare of the string representations of the values.
This class inherits from both IComparer and its generic counterpart
so that it can be used on untyped and typed collections.
This is used by normal (non-virtual) ObjectListViews. Virtual lists use
ModelObjectComparer
Create a ColumnComparer that will order the rows in a list view according
to the values in a given column
The column whose values will be compared
The ordering for column values
Create a ColumnComparer that will order the rows in a list view according
to the values in a given column, and by a secondary column if the primary
column is equal.
The column whose values will be compared
The ordering for column values
The column whose values will be compared for secondary sorting
The ordering for secondary column values
Compare two rows
row1
row2
An ordering indication: -1, 0, 1
Compare two rows
row1
row2
An ordering indication: -1, 0, 1
Compare the actual values to be used for sorting
The aspect extracted from the first row
The aspect extracted from the second row
An ordering indication: -1, 0, 1
Gets or sets the method that will be used to compare two strings.
The default is to compare on the current culture, case-insensitive
This comparer sort list view groups. OLVGroups have a "SortValue" property,
which is used if present. Otherwise, the titles of the groups will be compared.
Create a group comparer
The ordering for column values
Compare the two groups. OLVGroups have a "SortValue" property,
which is used if present. Otherwise, the titles of the groups will be compared.
group1
group2
An ordering indication: -1, 0, 1
This comparer can be used to sort a collection of model objects by a given column
This is used by virtual ObjectListViews. Non-virtual lists use
ColumnComparer
Create a model object comparer
Create a model object comparer with a secondary sorting column
Compare the two model objects
Compare the actual values
Gets or sets the method that will be used to compare two strings.
The default is to compare on the current culture, case-insensitive
Designer for and its subclasses.
This designer removes properties and events that are available on ListView but that are not
useful on ObjectListView.
We can't inherit from System.Windows.Forms.Design.ListViewDesigner, since it is marked internal.
So, this class uses reflection to create a ListViewDesigner and then forwards messages to that designer.
Initializes the designer with the specified component.
The to associate the designer with. This component must always be an instance of, or derive from, .
Initializes a newly created component.
A name/value dictionary of default values to apply to properties. May be null if no default values are specified.
Releases the unmanaged resources used by the and optionally releases the managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Removes the duplicate DockingActionList added by this designer to the .
adds an internal DockingActionList : 'Dock/Undock in Parent Container'.
But the default designer has already added that action list. So we need to remove one.
Adjusts the set of properties the component exposes through a .
An containing the properties for the class of the component.
Allows a designer to add to the set of events that it exposes through a .
The events for the class of the component.
Allows a designer to change or remove items from the set of attributes that it exposes through a .
The attributes for the class of the component.
Allows a designer to change or remove items from the set of events that it exposes through a .
The events for the class of the component.
Indicates whether a mouse click at the specified point should be handled by the control.
true if a click at the specified point is to be handled by the control; otherwise, false.
A indicating the position at which the mouse was clicked, in screen coordinates.
Processes Windows messages and optionally routes them to the control.
The to process.
Gets the design-time action lists supported by the component associated with the designer.
The design-time action lists supported by the component associated with the designer.
Gets the collection of components associated with the component managed by the designer.
The components that are associated with the component managed by the designer.
This class modifies a ListViewActionList, by removing the "Edit Items" and "Edit Groups" actions.
That class is internal, so we cannot simply subclass it, which would be simplier.
Action lists use reflection to determine if that action can be executed, so we not
only have to modify the returned collection of actions, but we have to implement
the properties and commands that the returned actions use.
This class works in conjunction with the OLVColumns property to allow OLVColumns
to be added to the ObjectListView.
Create a OLVColumnCollectionEditor
What type of object does this editor create?
Edit a given value
What text should be shown in the list for the given object?
Control how the overlay is presented in the IDE
An interface for an overlay that supports variable levels of transparency
Gets or sets the transparency of the overlay.
0 is completely transparent, 255 is completely opaque.
A null implementation of the IOverlay interface
Draw this overlay
The ObjectListView that is being overlaid
The Graphics onto the given OLV
The content area of the OLV
How transparent should this overlay be?
An overlay that will draw an image over the top of the ObjectListView
Create an ImageOverlay
Draw this overlay
The ObjectListView being decorated
The Graphics used for drawing
The bounds of the rendering
Gets or sets the horizontal inset by which the position of the overlay will be adjusted
Gets or sets the vertical inset by which the position of the overlay will be adjusted
An overlay that will draw text over the top of the ObjectListView
Create a TextOverlay
Draw this overlay
The ObjectListView being decorated
The Graphics used for drawing
The bounds of the rendering
Gets or sets the horizontal inset by which the position of the overlay will be adjusted
Gets or sets the vertical inset by which the position of the overlay will be adjusted
Gets or sets whether the border will be drawn with rounded corners
A Billboard overlay is a TextOverlay positioned at an absolute point
Create a BillboardOverlay
Draw this overlay
The ObjectListView being decorated
The Graphics used for drawing
The bounds of the rendering
Gets or sets where should the top left of the billboard be placed
This class provides compatibility for v1 RendererDelegates
The renderer delegate that this renderer wraps
This class maps a data value to an image that should be drawn for that value.
It is useful for drawing data that is represented as an enum or boolean.
Return a renderer that draw boolean values using the given images
Draw this when our data value is true
Draw this when our data value is false
A Renderer
Return a renderer that draw tristate boolean values using the given images
Draw this when our data value is true
Draw this when our data value is false
Draw this when our data value is null
A Renderer
Make a new empty renderer
Make a new renderer that will show the given image when the given key is the aspect value
The data value to be matched
The image to be shown when the key is matched
Make a new renderer that will show the given images when it receives the given keys
Build a renderer from the given array of keys and their matching images
An array of key/image pairs
Register the image that should be drawn when our Aspect has the data value.
Value that the Aspect must match
An ImageSelector -- an int, string or image
Render our value
Draw a collection of images
Draw one image
This renderer draws just a checkbox to match the check state of our model object.
Draw our cell
Handle the GetEditRectangle request
Handle the HitTest request
Render an image that comes from our data source.
The image can be sourced from:
- a byte-array (normally when the image to be shown is
stored as a value in a database)
- an int, which is treated as an index into the image list
- a string, which is treated first as a file name, and failing that as an index into the image list
- an ICollection of ints or strings, which will be drawn as consecutive images
If an image is an animated GIF, it's state is stored in the SubItem object.
By default, the image renderer does not render animations (it begins life with animations paused).
To enable animations, you must call Unpause().
In the current implementation (2009-09), each column showing animated gifs must have a
different instance of ImageRenderer assigned to it. You cannot share the same instance of
an image renderer between two animated gif columns. If you do, only the last column will be
animated.
Make an empty image renderer
Make an empty image renderer that begins life ready for animations
Finalizer
Pause any animations
Unpause any animations
Draw our image
Translate our Aspect into an image.
The strategy is:
- If its a byte array, we treat it as an in-memory image
- If it's an int, we use that as an index into our image list
- If it's a string, we try to load a file by that name. If we can't,
we use the string as an index into our image list.
An image
This is the method that is invoked by the timer. It basically switches control to the listview thread.
not used
This is the OnTimer callback, but invoked in the same thread as the creator of the ListView.
This method can use all of ListViews methods without creating a CrossThread exception.
Should the animations in this renderer be paused?
Gets a timer that can be used to trigger redraws on animations
Instances of this class kept track of the animation state of a single image.
Is the given image an animation
The image to be tested
Is the image an animation?
Create an AnimationState in a quiet state
Create an animation state for the given image, which may or may not
be an animation
The image to be rendered
Advance our images current frame and calculate when it will expire
Does this state represent a valid animation
Render our Aspect as a progress bar
Make a BarRenderer
Make a BarRenderer for the given range of data values
Make a BarRenderer using a custom bar scheme
Make a BarRenderer using a custom bar scheme
Make a BarRenderer that uses a horizontal gradient
Make a BarRenderer that uses a horizontal gradient
Draw this progress bar using a gradient
Draw our aspect
Handle the GetEditRectangle request
Should this bar be drawn in the system style?
How many pixels in from our cell border will this bar be drawn
What color will be used to fill the interior of the control before the
progress bar is drawn?
What color should the frame of the progress bar be?
How many pixels wide should the frame of the progress bar be?
What color should the 'filled in' part of the progress bar be?
This is only used if GradientStartColor is Color.Empty
Use a gradient to fill the progress bar starting with this color
Use a gradient to fill the progress bar ending with this color
Regardless of how wide the column become the progress bar will never be wider than this
Regardless of how high the cell is the progress bar will never be taller than this
The minimum data value expected. Values less than this will given an empty bar
The maximum value for the range. Values greater than this will give a full bar
The Pen that will draw the frame surrounding this bar
The brush that will be used to fill the bar
The brush that will be used to fill the background of the bar
An ImagesRenderer draws zero or more images depending on the data returned by its Aspect.
This renderer's Aspect must return a ICollection of ints, strings or Images,
each of which will be drawn horizontally one after the other.
As of v2.1, this functionality has been absorbed into ImageRenderer and this is now an
empty shell, solely for backwards compatibility.
A MultiImageRenderer draws the same image a number of times based on our data value
The stars in the Rating column of iTunes is a good example of this type of renderer.
Make a quiet renderer
Make an image renderer that will draw the indicated image, at most maxImages times.
Draw our data value
The index of the image that should be drawn
The name of the image that should be drawn
The image selector that will give the image to be drawn
Like all image selectors, this can be an int, string or Image
What is the maximum number of images that this renderer should draw?
Values less than or equal to this will have 0 images drawn
Values greater than or equal to this will have MaxNumberImages images drawn
A class to render a value that contains a bitwise-OR'ed collection of values.
Register the given image to the given value
When this flag is present...
...draw this image
Draw the flags
Do the actual work of hit testing. Subclasses should override this rather than HitTest()
This renderer draws an image, a single line title, and then multi-line description
under the title.
This class works best with FullRowSelect = true.
It's not designed to work with cell editing -- it will work but will look odd.
It's not RightToLeft friendly.
Create a DescribedTaskRenderer
Fetch the description from the model class
Draw our item
Draw the task
Handle the HitTest request
Should text be rendered using GDI routines? This makes the text look more
like a native List view control.
Gets or set the font that will be used to draw the title of the task
If this is null, the ListView's font will be used
Return a font that has been set for the title or a reasonable default
Gets or set the color of the title of the task
This color is used when the task is not selected or when the listview
has a translucent selection mechanism.
Return the color of the title of the task or a reasonable default
Gets or set the font that will be used to draw the description of the task
If this is null, the ListView's font will be used
Return a font that has been set for the title or a reasonable default
Gets or set the color of the description of the task
This color is used when the task is not selected or when the listview
has a translucent selection mechanism.
Return the color of the description of the task or a reasonable default
Gets or sets the number of pixels that will be left between the image and the text
Gets or sets the number of pixels that will be left between the title and the description
Gets or sets the name of the aspect of the model object that contains the task description
Gets or sets the filter that is filtering the ObjectListView and for
which this renderer should highlight text
When a filter changes, keep track of the text matching filters
This renderer draws a functioning button in its cell
Calculate the size of the contents
Draw the button
What part of the control is under the given point?
What is the state of the button?
Gets or sets how each button will be sized
Gets or sets the size of the button when the SizingMode is FixedBounds
If this is not set, the bounds of the cell will be used
Gets or sets the extra space that surrounds the cell when the SizingMode is TextBounds
Gets or sets the maximum width that a button can occupy.
-1 means there is no maximum width.
This is only considered when the SizingMode is TextBounds
Gets or sets the minimum width that a button can occupy.
-1 means there is no minimum width.
This is only considered when the SizingMode is TextBounds
Is the mouse over the button?
The common interface supported by all style objects
Gets or set the font that will be used by this style
Gets or set the font style
Gets or sets the ForeColor
Gets or sets the BackColor
Basic implementation of IItemStyle
Gets or sets the font that will be applied by this style
Gets or sets the style of font that will be applied by this style
Gets or sets the color of the text that will be applied by this style
Gets or sets the background color that will be applied by this style
Instances of this class specify how should "hot items" (non-selected
rows under the cursor) be renderered.
Gets or sets the overlay that should be drawn as part of the hot item
Gets or sets the decoration that should be drawn as part of the hot item
A decoration is different from an overlay in that an decoration
scrolls with the listview contents, whilst an overlay does not.
This class defines how a cell should be formatted
Gets or sets the font that will be applied by this style
Gets or sets the style of font that will be applied by this style
Gets or sets the color of the text that will be applied by this style
Gets or sets the background color that will be applied by this style
Instances of this class describe how hyperlinks will appear
Create a HyperlinkStyle
What sort of formatting should be applied to hyperlinks in their normal state?
What sort of formatting should be applied to hyperlinks when the mouse is over them?
What sort of formatting should be applied to hyperlinks after they have been clicked?
Gets or sets the cursor that should be shown when the mouse is over a hyperlink.
Instances of this class control one the styling of one particular state
(normal, hot, pressed) of a header control
Gets or sets the font that will be applied by this style
Gets or sets the color of the text that will be applied by this style
Gets or sets the background color that will be applied by this style
Gets or sets the color in which a frame will be drawn around the header for this column
Gets or sets the width of the frame that will be drawn around the header for this column
This class defines how a header should be formatted in its various states.
Create a new HeaderFormatStyle
Set the font for all three states
Set the fore color for all three states
Set the back color for all three states
What sort of formatting should be applied to a column header when the mouse is over it?
What sort of formatting should be applied to a column header in its normal state?
What sort of formatting should be applied to a column header when pressed?
A limited wrapper around a Windows tooltip window.
Create the underlying control.
The parent of the tooltip
This does nothing if the control has already been created
Take a copy of the current settings and restore them when the
tooltip is poppped.
This call cannot be nested. Subsequent calls to this method will be ignored
until PopSettings() is called.
Restore the settings of the tooltip as they were when PushSettings()
was last called.
Add the given window to those for whom this tooltip will show tips
The window
Hide any currently visible tooltip
Remove the given window from those managed by this tooltip
Set the maximum width of a tooltip string.
Set the maximum width of a tooltip string.
Setting this ensures that line breaks in the tooltip are honoured.
Make a TOOLINFO structure for the given window
A filled in TOOLINFO
Handle a WmNotify message
The msg
True if the message has been handled
Handle a get display info message
The msg
True if the message has been handled
Handle a TTN_LINKCLICK message
The msg
True if the message has been handled
This cannot call base.WndProc() since the msg may have come from another control.
Handle a TTN_POP message
The msg
True if the message has been handled
This cannot call base.WndProc() since the msg may have come from another control.
Handle a TTN_SHOW message
The msg
True if the message has been handled
This cannot call base.WndProc() since the msg may have come from another control.
Handle a reflected notify message
The msg
True if the message has been handled
Mess with the basic message pump of the tooltip
Get or set if the style of the tooltip control
Get or set if the tooltip should be shown as a ballon
Get or set if the tooltip should be shown as a ballon
Get or set the background color of the tooltip
Get or set the color of the text and border on the tooltip.
Get or set the title that will be shown on the tooltip.
Get or set the icon that will be shown on the tooltip.
Gets or sets the font that will be used to draw this control.
is still.
Setting this to null reverts to the default font.
Gets or sets how many milliseconds the tooltip will remain visible while the mouse
is still.
Gets or sets how many milliseconds the mouse must be still before the tooltip is shown.
Gets or sets how many milliseconds the mouse must be still before the tooltip is shown again.
Tell the world that a tooltip is about to show
Tell the world that a tooltip is about to disappear
These are the standard icons that a tooltip can display.
No icon
Info
Warning
Error
Large info (Vista and later only)
Large warning (Vista and later only)
Large error (Vista and later only)
An OLVExporter converts a collection of rows from an ObjectListView
into a variety of textual formats.
Create an empty exporter
Create an exporter that will export all the rows of the given ObjectListView
Create an exporter that will export all the given rows from the given ObjectListView
Export the nominated rows from the nominated ObjectListView.
Returns the result in the expected format.
This will perform only one conversion, even if called multiple times with different formats.
Convert
Encode a string such that it can be used as a value in a CSV file.
This basically means replacing any quote mark with two quote marks,
and enclosing the whole string in quotes.
HTML-encodes a string and returns the encoded string.
The text string to encode.
The HTML-encoded text.
Taken from http://www.west-wind.com/weblog/posts/2009/Feb/05/Html-and-Uri-String-Encoding-without-SystemWeb
Gets or sets whether hidden columns will also be included in the textual
representation. If this is false (the default), only visible columns will
be included.
Gets or sets whether column headers will also be included in the text
and HTML representation. Default is true.
Gets the ObjectListView that is being used as the source of the data
to be exported
Gets the model objects that are to be placed in the data object
What format will be used for exporting
Tab separated values, according to http://www.iana.org/assignments/media-types/text/tab-separated-values
Alias for TabSeparated
Comma separated values, according to http://www.ietf.org/rfc/rfc4180.txt
HTML table, according to me
A TypedObjectListView is a type-safe wrapper around an ObjectListView.
VCS does not support generics on controls. It can be faked to some degree, but it
cannot be completely overcome. In our case in particular, there is no way to create
the custom OLVColumn's that we need to truly be generic. So this wrapper is an
experiment in providing some type-safe access in a way that is useful and available today.
A TypedObjectListView is not more efficient than a normal ObjectListView.
Underneath, the same name of casts are performed. But it is easier to use since you
do not have to write the casts yourself.
The class of model object that the list will manage
To use a TypedObjectListView, you write code like this:
TypedObjectListView<Person> tlist = new TypedObjectListView<Person>(this.listView1);
tlist.CheckStateGetter = delegate(Person x) { return x.IsActive; };
tlist.GetColumn(0).AspectGetter = delegate(Person x) { return x.Name; };
...
To iterate over the selected objects, you can write something elegant like this:
foreach (Person x in tlist.SelectedObjects) {
x.GrantSalaryIncrease();
}
Create a typed wrapper around the given list.
The listview to be wrapped
Return a typed wrapper around the column at the given index
The index of the column
A typed column or null
Return a typed wrapper around the column with the given name
The name of the column
A typed column or null
Return the model object at the given index
The index of the model object
The model object or null
This method will generate AspectGetters for any column that has an AspectName.
Return the model object that is checked, if only one row is checked.
If zero rows are checked, or more than one row, null is returned.
Return the list of all the checked model objects
The ObjectListView that is being wrapped
Get or set the list of all model objects
Return the model object that is selected, if only one row is selected.
If zero rows are selected, or more than one row, null is returned.
The list of model objects that are selected.
Gets or sets the check state getter
Gets or sets the boolean check state getter
Gets or sets the check state putter delegate
Gets or sets the boolean check state putter
Gets or sets the cell tooltip getter
Gets or sets the header tool tip getter
CheckStateGetter
BooleanCheckStateGetter
CheckStatePutter
BooleanCheckStatePutter
ToolTipGetter
A type-safe wrapper around an OLVColumn
Creates a TypedColumn
Generate an aspect getter that does the same thing as the AspectName,
except without using reflection.
If you have an AspectName of "Owner.Address.Postcode", this will generate
the equivilent of: this.AspectGetter = delegate (object x) {
return x.Owner.Address.Postcode;
}
If AspectName is empty, this method will do nothing, otherwise
this will replace any existing AspectGetter.
Generates an aspect getter method dynamically. The method will execute
the given dotted chain of selectors against a model object given at runtime.
The type of model object to be passed to the generated method
A dotted chain of selectors. Each selector can be the name of a
field, property or parameter-less method.
A typed delegate
This method generates the actual IL for the method.
A IVirtualGroups is the interface that a virtual list must implement to support virtual groups
Return the list of groups that should be shown according to the given parameters
Return the index of the item that appears at the given position within the given group.
Return the index of the group to which the given item belongs
Return the index at which the given item is shown in the given group
A hint that the given range of items are going to be required
This is a safe, do nothing implementation of a grouping strategy
Return the list of groups that should be shown according to the given parameters
Return the index of the item that appears at the given position within the given group.
Return the index of the group to which the given item belongs
Return the index at which the given item is shown in the given group
A hint that the given range of items are going to be required
Provides grouping functionality to a FastObjectListView
Create groups for FastListView
This is the COM interface that a ListView must be given in order for groups in virtual lists to work.
This interface is NOT documented by MS. It was found on Greg Chapell's site. This means that there is
no guarantee that it will work on future versions of Windows, nor continue to work on current ones.
Not sure what this does
Not sure what this does
Get the index of the item that occurs at the n'th position of the indicated group.
Index of the group
Index within the group
Index of the item within the whole list
Get the index of the group to which the given item belongs
Index of the item within the whole list
Which occurences of the item is wanted
Index of the group
Get the number of groups that contain the given item
Index of the item within the whole list
How many groups does it occur within
A hint to prepare any cache for the given range of requests
A default implementation of the IOwnerDataCallback interface
This class mimics the behavior of VirtualObjectListView v1.x.
Creates a VirtualListVersion1DataSource
How will the n'th object of the data source be fetched?