C# Class BrightIdeasSoftware.ObjectListView

Inheritance: System.Windows.Forms.ListView, ISupportInitialize
Datei anzeigen Open project: soywiz/cspspemu Class Usage Examples

Public Properties

Property Type Description
EditorRegistry EditorRegistry
SortAscendingImage Bitmap
SortDescendingImage Bitmap

Private Properties

Property Type Description
AddCheckStateBitmap void
ApplyHyperlinkStyle void
BuildBeforeSortingEventArgs BrightIdeasSoftware.BeforeSortingEventArgs
BuildCellEvent void
CalculateCellBounds System.Drawing.Rectangle
CalculateCheckState CheckState
CalculateToggledCheckState CheckState
ColumnSelectMenuClosing void
ColumnSelectMenuItemClicked void
DoSort void
FindGlassPanelForOverlay GlassPanelForm
GetCheckedObject object
GetCheckedObjects ArrayList
GetFirstNonNullValue object
GetSelectedObject object
GetSelectedObjects ArrayList
HandleHeaderRightClick bool
HandleModelOnPropertyChanged void
HeaderToolTipShowingCallback void
LowLevelScroll void
MakeResizedImage Bitmap
MakeResizedImageList ImageList
MakeSubItem OLVListSubItem
MakeTriangleBitmap Bitmap
PrepareAlternateBackColors void
RememberDisplayIndicies void
RunWhenIdle void
SetAllSubItemImages void
SetGroupSpacing void
SetupBaseImageList void
ShouldShowOverlays bool
ShowColumnCommandMenu void
ShowColumnSelectMenu void
StateToString string
SubscribeNotifications void
ToggleSelectedRowCheckBoxes void
UnsubscribeNotifications void

Public Methods

Method Description
AddDecoration ( IDecoration decoration ) : void

Add the given decoration to those on this list and make it appear

A decoration scrolls with the listview. An overlay stays fixed in place.

AddObject ( object modelObject ) : void

Add the given model object to this control.

See AddObjects() for more details

AddObjects ( ICollection modelObjects ) : void

Add the given collection of model objects to this control.

The added objects will appear in their correct sort position, if sorting is active (i.e. if LastSortColumn 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.

AddOverlay ( IOverlay overlay ) : void

Add the given overlay to those on this list and make it appear

AutoResizeColumns ( ) : void

Resize the columns to the maximum of the header width and the data.

BuildGroups ( ) : void

Organise the view items into groups, based on the last sort column or the first column if there is no last sort column

BuildGroups ( OLVColumn column, SortOrder order ) : void

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.

BuildGroups ( OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder ) : void

Organise the view items into groups, based on the given columns

This method does not trigger sorting events. Use BuildGroups() to do that

BuildList ( ) : void

Build/rebuild all the list view items in the list, preserving as much state as is possible

BuildList ( bool shouldPreserveState ) : void

Build/rebuild all the list view items in the list

Use this method in situations were the contents of the list is basically the same as previously.

CalculateCellBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex ) : Rectangle

Return the bounds of the given cell

CalculateCellEditorBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle

Calculate the bounds of the edit control for the given item/column

CalculateCellTextBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex ) : Rectangle

Return the bounds of the given cell only until the edge of the current text

CalculateReasonableTileSize ( ) : void

Give the listview a reasonable size of its tiles, based on the number of lines of information that each tile is going to display.

CancelCellEdit ( ) : void

Stop editing a cell and throw away any changes.

ChangeToFilteredColumns ( View view ) : void

Rebuild this list for the given view

CheckIndeterminateObject ( object modelObject ) : void

Mark the given object as indeterminate check state

CheckIndeterminateSubItem ( object rowObject, OLVColumn column ) : void

Put an indeterminate check into the check box at the given cell

CheckObject ( object modelObject ) : void

Mark the given object as checked in the list

CheckObjects ( IEnumerable modelObjects ) : void

Mark the given objects as checked in the list

CheckSubItem ( object rowObject, OLVColumn column ) : void

Put a check into the check box at the given cell

ClearHotItem ( ) : void

Force the hot item to be recalculated

ClearObjects ( ) : void

Remove all items from this list

ClearUrlVisited ( ) : void

Reset the memory of which URLs have been visited

ConfigureAutoComplete ( TextBox tb, OLVColumn column ) : void

Configure the given text box to autocomplete unique values from the given column. At most 1000 rows will be considered.

ConfigureAutoComplete ( TextBox tb, OLVColumn column, int maxRows ) : void

Configure the given text box to autocomplete unique values from the given column. At most 1000 rows will be considered.

CopyObjectsToClipboard ( IList objectsToCopy ) : void

Copy a text and html representation of the given objects onto the clipboard.

CopySelectionToClipboard ( ) : void

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.

CreateColumnFilter ( ) : IModelFilter

Create a filter that will enact all the filtering currently installed on the visible columns.

DeselectAll ( ) : void

Deselect all rows in the listview

DropSinkCanDrop ( object sender, OlvDropEventArgs e ) : void
DropSinkDropped ( object sender, OlvDropEventArgs e ) : void
DropSinkModelCanDrop ( object sender, ModelDropEventArgs e ) : void
DropSinkModelDropped ( object sender, ModelDropEventArgs e ) : void
EditSubItem ( OLVListItem item, int subItemIndex ) : void

Begin an edit operation on the given cell.

This performs various sanity checks and passes off the real work to StartCellEdit().

EnableCustomSelectionColors ( ) : void

Setup the list so it will draw selected rows using custom colours.

This method makes the list owner drawn, and ensures that all columns have at least a BaseRender installed.

EnsureGroupVisible ( ListViewGroup lvg ) : void

Scroll the listview so that the given group is at the top.

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 VirtualObjectListView.EnsureNthGroupVisible instead.

EnsureModelVisible ( Object modelObject ) : void

Ensure that the given model object is visible

EnumerableToArray ( IEnumerable collection, bool alwaysCreate ) : ArrayList

Convert the given enumerable into an ArrayList as efficiently as possible

When we move to .NET 3.5, we can use LINQ and not need this method.

FindMatchingRow ( string text, int start, SearchDirectionHint direction ) : int

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 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.

FinishCellEdit ( ) : void

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.

FinishCellEdit ( bool expectingCellEdit ) : void

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.

Freeze ( ) : void

Freeze the listview so that it no longer updates itself.

Freeze()/Unfreeze() calls nest correctly

GetCellToolTip ( int columnIndex, int rowIndex ) : String

Return the tooltip that should be shown when the mouse is hovered over the given cell

GetColumn ( int index ) : OLVColumn

Return the column at the given index

GetColumn ( string name ) : OLVColumn

Return the column at the given title.

GetDisplayOrderOfItemIndex ( int itemIndex ) : int

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.

GetFilteredColumns ( View view ) : List

Return a collection of columns that are visible to the given view. Only Tile and Details have columns; all other views have 0 columns.

GetHeaderToolTip ( int columnIndex ) : String

Return the tooltip that should be shown when the mouse is hovered over the given column

GetItem ( int index ) : OLVListItem

Return the item at the given index

GetItemAt ( int x, int y, OLVColumn &hitColumn ) : OLVListItem

Find the item and column that are under the given co-ords

GetItemCount ( ) : int

Return the number of items in the list

GetLastItemInDisplayOrder ( ) : OLVListItem

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.

GetModelObject ( int index ) : object

Return the model object at the given index

GetNextItem ( OLVListItem itemToFind ) : OLVListItem

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.

GetNthItemInDisplayOrder ( int n ) : OLVListItem

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.

GetPreviousItem ( OLVListItem itemToFind ) : 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.

GetSubItem ( int index, int columnIndex ) : OLVListSubItem

Return the sub item at the given index/column

HasDecoration ( IDecoration decoration ) : bool

Is the given decoration shown on this list

HasOverlay ( IOverlay overlay ) : bool

Is the given overlay shown on this list?

HideOverlays ( ) : void

Hide any overlays.

This is only a temporary hiding -- the overlays will be shown the next time the ObjectListView redraws.

HitTest ( int x, int y ) : ListViewHitTestInfo

Calculate what item is under the given point?

ISupportInitialize ( ) : void
IndexOf ( Object modelObject ) : int

Find the given model object within the listview and return its index

InsertObjects ( int index, ICollection modelObjects ) : void

Insert the given collection of objects before the given position

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.

IsChecked ( object modelObject ) : bool

Return true of the given object is checked

If the given object is not in the list, this method returns false.

IsCheckedIndeterminate ( object modelObject ) : bool

Return true of the given object is indeterminately checked

If the given object is not in the list, this method returns false.

IsEnumerableEmpty ( IEnumerable collection ) : bool
IsSelected ( object model ) : bool

Return true if the row representing the given model is selected

IsSubItemChecked ( object rowObject, OLVColumn column ) : bool

Is there a check at the check box at the given cell

IsUrlVisited ( string url ) : bool

Has the given URL been visited?

MakeColumnCommandMenu ( ToolStripDropDown strip, int columnIndex ) : ToolStripDropDown

Append the column selection menu items to the given menu strip.

MakeColumnSelectMenu ( ToolStripDropDown strip ) : ToolStripDropDown

Append the column selection menu items to the given menu strip.

MakeFilteringMenu ( ToolStripDropDown strip, int columnIndex ) : ToolStripDropDown

Create a Filtering menu

MarkUrlVisited ( string url ) : void

Remember that the given URL has been visited

This does not cause the control be redrawn

ModelToItem ( object modelObject ) : OLVListItem

Return the OLVListItem that displays the given model object

This method has O(n) performance.

MoveObjects ( int index, ICollection modelObjects ) : void

Move the given collection of objects to the given index.

This operation only makes sense on non-grouped ObjectListViews.

ObjectListView ( ) : System

Create an ObjectListView

ObjectsToHtml ( IList objectsToConvert ) : string

Return a html representation of the given objects

OlvHitTest ( int x, int y ) : OlvListViewHitTestInfo

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

PauseAnimations ( bool isPause ) : void

Pause (or unpause) all animations in the list

PossibleFinishCellEditing ( ) : bool

If a cell edit is in progress, finish the edit.

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.

PossibleFinishCellEditing ( bool expectingCellEdit ) : bool

If a cell edit is in progress, finish the edit.

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.

RebuildColumns ( ) : void

Rebuild the columns based upon its current view and column visibility settings

RefreshHotItem ( ) : void

Force the hot item to be recalculated

RefreshItem ( OLVListItem olvi ) : void

Update the 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

RefreshObject ( object modelObject ) : void

Update the rows that are showing the given objects

This method does not resort or regroup the view.

RefreshObjects ( IList modelObjects ) : void

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.

RefreshOverlay ( IOverlay overlay ) : void

Refresh the display of just one overlays

RefreshOverlays ( ) : void

Refresh the display of the overlays

RefreshSelectedObjects ( ) : void

Update the rows that are selected

This method does not resort or regroup the view.

RemoveDecoration ( IDecoration decoration ) : void

Remove the given decoration from this list

RemoveObject ( object modelObject ) : void

Remove the given model object from the ListView

See RemoveObjects() for more details

This method is thread-safe.

RemoveObjects ( ICollection modelObjects ) : void

Remove all of the given objects from the control.

Nulls and model objects that are not in the ListView are silently ignored.

This method is thread-safe.

RemoveOverlay ( IOverlay overlay ) : void

Remove the given overlay to those on this list

Reset ( ) : void

Make the list forget everything -- all rows and all columns

Use ClearObjects if you want to remove just the rows.

ResetColumnFiltering ( ) : void

Remove all column filtering.

RestoreState ( byte state ) : bool

Restore the state of the control from the given string, which must have been produced by SaveState()

SaveState ( ) : byte[]

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.

SelectAll ( ) : void

Select all rows in the listview

SelectObject ( object modelObject ) : void

Select the row that is displaying the given model object, in addition to any current selection.

Use the SelectedObject property to deselect all other rows

SelectObject ( object modelObject, bool setFocus ) : void

Select the row that is displaying the given model object, in addition to any current selection.

Use the SelectedObject property to deselect all other rows

SelectObjects ( IList modelObjects ) : void

Select the rows that is displaying any of the given model object. All other rows are deselected.

SetNativeBackgroundImage ( Image image, int xOffset, int yOffset ) : void

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 SetNativeBackgroundWatermark. Make sure those limitations are understood before using the method.

This is very similar to setting the System.Windows.Forms.Control.BackgroundImage 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.

SetNativeBackgroundTiledImage ( Image image ) : void

Set the given image to be the tiled background of the ListView.

This has the same limitations as described in SetNativeBackgroundWatermark and SetNativeBackgroundImage. Make sure those limitations are understood before using the method.

SetNativeBackgroundWatermark ( Image image ) : void

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.

SetObjects ( IEnumerable collection ) : void

Set the collection of objects that will be shown in this list view.

The list is updated immediately

SetObjects ( IEnumerable collection, bool preserveState ) : void

Set the collection of objects that will be shown in this list view.

The list is updated immediately

SetSubItemImage ( int rowIndex, int subItemIndex, OLVListSubItem subItem, bool shouldClearImages ) : void

Set the subitem image natively

SetupSubItemCheckBoxes ( ) : void

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.

ShowOverlays ( ) : void

Make sure that any overlays are visible.

ShowSortIndicator ( ) : void

Put a sort indicator next to the text of the sort column

Sort ( ) : void

Sort the items by the last sort column and order

Sort ( OLVColumn columnToSort ) : void

Sort the items in the list view by the values in the given column and the last sort order

Sort ( OLVColumn columnToSort, SortOrder order ) : void

Sort the items in the list view by the values in the given column and by the given order.

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.

Sort ( int columnToSortIndex ) : void

Sort the items in the list view by the values in the given column and the last sort order

Sort ( string columnToSortName ) : void

Sort the items in the list view by the values in the given column and the last sort order

StartCellEdit ( OLVListItem item, int subItemIndex ) : void

Really start an edit operation on a given cell. The parameters are assumed to be sane.

ToggleCheckObject ( object modelObject ) : void

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 ...

ToggleSubItemCheckBox ( object rowObject, OLVColumn column ) : void

Toggle the check at the check box of the given cell

UncheckObject ( object modelObject ) : void

Mark the given object as unchecked in the list

UncheckObjects ( IEnumerable modelObjects ) : void

Mark the given objects as unchecked in the list

UncheckSubItem ( object rowObject, OLVColumn column ) : void

Uncheck the check at the given cell

Unfreeze ( ) : void

Unfreeze the listview. If this call is the outermost Unfreeze(), the contents of the listview will be rebuilt.

Freeze()/Unfreeze() calls nest correctly

Unsort ( ) : void

Remove any sorting and revert to the given order of the model objects

UpdateColumnFiltering ( ) : void

Update the filtering of this ObjectListView based on the value filtering defined in each column

Protected Methods

Method Description
AddItemsToColumnSelectMenu ( ToolStripItemCollection items ) : void

Create the menu items that will allow columns to be choosen and add them to the given collection

ApplyCellStyle ( BrightIdeasSoftware.OLVListItem olvi, int columnIndex, IItemStyle style ) : void

Apply a style to a cell

ApplyExtendedStyles ( ) : void

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!).

ApplyRowStyle ( BrightIdeasSoftware.OLVListItem olvi, IItemStyle style ) : void

Apply a style to the given row

CalculateCellEditorBoundsOwnerDrawn ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Rectangle r, Size preferredSize ) : Rectangle

Calculate the bounds of the edit control for the given item/column, when the listview is being owner drawn.

CalculateCellEditorBoundsStandard ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Rectangle cellBounds, Size preferredSize ) : Rectangle

Calculate the bounds of the edit control for the given item/column, when the listview is not being owner drawn.

CalculateOwnerDrawnHitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Perform a hit test when the control is owner drawn. This hands off responsibility to the renderer.

CalculateStandardHitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Perform a hit test when the control is not owner drawn

CellEditor_Validating ( object sender, CancelEventArgs e ) : void

Called when the cell editor could be about to lose focus. Time to commit the change

CleanupCellEdit ( bool expectingCellEdit ) : void

Remove all trace of any existing cell edit operation

ClearPersistentCheckState ( ) : void

Forget any persistent checkbox state

CollectGroupingParameters ( OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder ) : BrightIdeasSoftware.GroupingParameters

Collect and return all the variables that influence the creation of groups

ConfigureControl ( ) : void

Setup the given control to be a cell editor

CorrectSubItemColors ( ListViewItem olvi ) : void

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

Cells drawn via BaseRenderer don't need this, but it is needed when an owner drawn cell uses DrawDefault=true

CreateCellToolTip ( ) : void

Create a ToolTipControl to manage the tooltip control used by the listview control

CreateGroups ( IEnumerable groups ) : void

Do the actual work of creating the given list of groups

Dispose ( bool disposing ) : void

Dispose of any resources this instance has been using

DoUnfreeze ( ) : void

Do the actual work required when the listview is unfrozen

DrawAllDecorations ( Graphics g, List drawnItems ) : void

Draw all the decorations

FillInValues ( OLVListItem lvi, object rowObject ) : void

Fill in the given OLVListItem with values of the given row

FilterObjects ( IEnumerable originalObjects, IModelFilter aModelFilter, IListFilter aListFilter ) : IEnumerable

Do the actual work of filtering

FindMatchInRange ( string text, int first, int last, OLVColumn column ) : int

Find the first row in the given range of rows that prefix matches the string value of the given column.

ForceSubItemImagesExStyle ( ) : void

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.

GetActualImageIndex ( Object imageSelector ) : int

Convert the given image selector to an index into our image list. Return -1 if that's not possible

GetCellEditor ( OLVListItem item, int subItemIndex ) : Control

Return a control that can be used to edit the value of the given cell.

GetCheckState ( Object modelObject ) : CheckState?

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.

GetControlValue ( Control control ) : Object

Return the value that the given control is showing

GetPersistentCheckState ( object model ) : CheckState

Gets the checkedness of the given model.

HandleApplicationIdle ( object sender, EventArgs e ) : void

The application is idle. Trigger a SelectionChanged event.

HandleApplicationIdleResizeColumns ( object sender, EventArgs e ) : void

The application is idle. Trigger a SelectionChanged event.

HandleBeginScroll ( Message &m ) : bool

Handle the BeginScroll listview notification

HandleCellToolTipShowing ( object sender, ToolTipShowingEventArgs e ) : void

The cell tooltip control wants information about the tool tip that it should show.

HandleChar ( Message &m ) : bool

Handle the search for item m if possible.

HandleColumnClick ( object sender, ColumnClickEventArgs e ) : void

Event handler for the column click event

HandleColumnWidthChanged ( object sender, ColumnWidthChangedEventArgs e ) : void

When the column widths change, resize the space filling columns

HandleColumnWidthChanging ( object sender, ColumnWidthChangingEventArgs e ) : void

When the column widths are changing, resize the space filling columns

HandleContextMenu ( Message &m ) : bool

The user wants to see the context menu.

We want to ignore context menu requests that are triggered by right clicks on the header

HandleCustomDraw ( Message &m ) : bool

Handle the Custom draw series of notifications

HandleDestroy ( Message &m ) : bool

Handle the underlying control being destroyed

HandleEndScroll ( Message &m ) : bool

Handle the EndScroll listview notification

HandleFindItem ( Message &m ) : bool

Handle the search for item m if possible.

HandleGroupInfo ( Message &m ) : bool

Handle the Group Info series of notifications

HandleHeaderRightClick ( int columnIndex ) : bool

The user has right clicked on the column headers. Do whatever is required

HandleHeaderToolTipShowing ( object sender, ToolTipShowingEventArgs e ) : void

The header tooltip control wants information about the tool tip that it should show.

HandleKeyDown ( Message &m ) : bool

Handle a key down message

HandleLButtonDoubleClick ( Message &m ) : bool

Catch the Left Button double click event.

HandleLButtonDown ( Message &m ) : bool

Catch the Left Button down event.

HandleLButtonUp ( Message &m ) : bool

Catch the Left Button up event.

HandleLayout ( object sender, LayoutEventArgs e ) : void

When the size of the control changes, we have to resize our space filling columns.

HandleLinkClick ( Message &m ) : bool

Handle the LinkClick listview notification

HandleMouseMove ( Message &m ) : bool

Catch the MouseMove event.

HandleNotify ( Message &m ) : bool

In the notification messages, we handle attempts to change the width of our columns

HandlePaint ( Message &m ) : bool

Handle the WM_PAINT event

HandlePostPaint ( ) : void

Perform any steps needed after painting the control

HandlePrePaint ( ) : void

Perform any steps needed before painting the control

HandleRButtonDoubleClick ( Message &m ) : bool

Catch the right Button double click event.

HandleRButtonDown ( Message &m ) : bool

Catch the Right Button down event.

HandleReflectNotify ( Message &m ) : bool

Handle notifications that have been reflected back from the parent window

HandleWindowPosChanging ( Message &m ) : bool

Handle the window position changing.

InitializeCheckBoxImages ( ) : void

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.

InitializeEmptyListMsgOverlay ( ) : void

Create and configure the empty list msg overlay

InitializeStandardOverlays ( ) : void

Initialize the standard image and text overlays

InitializeStateImageList ( ) : void

Initialize the state image list with the required checkbox images

LowLevelHitTest ( int x, int y ) : OlvListViewHitTestInfo

Perform a hit test using the Windows control's SUBITEMHITTEST message. This provides information about group hits that the standard ListView.HitTest() does not.

MakeDefaultCellEditor ( OLVColumn column ) : Control

Return a TextBox that can be used as a default cell editor.

MakeGroups ( GroupingParameters parms ) : IList

Make a list of groups that should be shown according to the given parameters

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.

MakeHeaderRightClickMenu ( int columnIndex ) : ToolStripDropDown

Create the menu that should be displayed when the user right clicks on the given column header.

MakeSortIndicatorImages ( ) : void

If the sort indicator images don't already exist, this method will make and install them

OnColumnReordered ( ColumnReorderedEventArgs e ) : void

Override the OnColumnReordered method to do what we want

OnControlCreated ( ) : void

This method is called after the control has been fully created.

OnDragDrop ( DragEventArgs args ) : void

OnDragEnter ( DragEventArgs args ) : void

OnDragLeave ( EventArgs e ) : void

OnDragOver ( DragEventArgs args ) : void

OnDrawColumnHeader ( DrawListViewColumnHeaderEventArgs e ) : void

Owner draw the column header

OnDrawItem ( DrawListViewItemEventArgs e ) : void

Owner draw the item

OnDrawSubItem ( DrawListViewSubItemEventArgs e ) : void

Owner draw a single subitem

OnGiveFeedback ( GiveFeedbackEventArgs args ) : void

OnHandleCreated ( EventArgs e ) : void

Called when the handle of the underlying control is created

OnItemDrag ( ItemDragEventArgs e ) : void

OnMouseDown ( MouseEventArgs e ) : void

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.

OnMouseLeave ( EventArgs e ) : void

When the mouse leaves the control, remove any hot item highlighting

OnMouseMove ( MouseEventArgs e ) : void

When the mouse moves, we might need to change the hot item.

OnMouseUp ( MouseEventArgs e ) : void

Check to see if we need to start editing a cell

OnQueryContinueDrag ( QueryContinueDragEventArgs args ) : void

OnRightMouseUp ( MouseEventArgs e ) : void

The user right clicked on the control

OnSelectedIndexChanged ( EventArgs e ) : void

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

PostProcessOneRow ( int rowIndex, int displayIndex, OLVListItem olvi ) : void

Do the work required after one item in a listview have been created

PostProcessRows ( ) : void

Do the work required after the items in a listview have been created

ProcessDialogKey ( Keys keyData ) : bool

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.

ProcessHyperlinkClicked ( CellClickEventArgs e ) : void

Tell the world that a hyperlink was clicked and if the event isn't handled, do the default processing.

ProcessLButtonDoubleClick ( OlvListViewHitTestInfo hti ) : bool

Handle a mouse double click at the given hit test location

Subclasses can override this to do something unique

ProcessLButtonDown ( OlvListViewHitTestInfo hti ) : bool

Handle a left mouse down at the given hit test location

Subclasses can override this to do something unique

ProcessRButtonDoubleClick ( OlvListViewHitTestInfo hti ) : bool

Handle a right mouse double click at the given hit test location

Subclasses can override this to do something unique

ProcessRButtonDown ( OlvListViewHitTestInfo hti ) : bool

Handle a left mouse down at the given hit test location

Subclasses can override this to do something unique

PutCheckState ( Object modelObject, CheckState state ) : CheckState

Record the change of checkstate for the given object in the model. This does not update the UI -- only the model

ResizeFreeSpaceFillingColumns ( ) : void

Resize our space filling columns so they fill any unoccupied width in the control

ResizeFreeSpaceFillingColumns ( int freeSpace ) : void

Resize our space filling columns so they fill any unoccupied width in the control

SetControlValue ( Control control, Object value, String stringValue ) : void

Try to give the given value to the provided control. Fall back to assigning a string if the value assignment fails.

SetObjectCheckedness ( object modelObject, CheckState state ) : void

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.

SetPersistentCheckState ( object model, CheckState state ) : CheckState

Remember the check state of the given model object

SetSubItemImages ( int rowIndex, OLVListItem item ) : void

Tell the underlying list control which images to show against the subitems

SetSubItemImages ( int rowIndex, OLVListItem item, bool shouldClearImages ) : void

Tell the underlying list control which images to show against the subitems

ShouldStartCellEdit ( MouseEventArgs e ) : bool

Should we start editing the cell in response to the given mouse button event?

ShowHeaderRightClickMenu ( int columnIndex, Point pt ) : bool

Show a menu that is appropriate when the given column header is clicked.

ShowSortIndicator ( OLVColumn columnToSort, SortOrder sortOrder ) : void

Put a sort indicator next to the text of the given given column

StandardHyperlinkClickedProcessing ( HyperlinkClickedEventArgs args ) : void

Do the default processing for a hyperlink clicked event, which is to try and open the url.

TakeOwnershipOfObjects ( ) : void

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.

TriggerFormatRowEvent ( int rowIndex, int displayIndex, OLVListItem olvi ) : void

Trigger FormatRow and possibly FormatCell events for the given item

TriggerGroupExpandCollapse ( OLVGroup group ) : bool

Trigger a GroupExpandCollapse event and return true if the action was cancelled

UnapplyHotItem ( int index ) : void

Remove hot item styling from the given row

UpdateCellToolTipHandle ( ) : void

Update the handle used by our cell tooltip to be the tooltip used by the underlying Windows listview control.

UpdateFiltering ( ) : void

When some setting related to filtering changes, this method is called.

UpdateHotItem ( OlvListViewHitTestInfo hti ) : void

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

UpdateHotItem ( Point pt ) : void

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

UpdateHotRow ( OLVListItem olvi ) : void

Update the given row using the current hot item information

UpdateHotRow ( int rowIndex, int columnIndex, HitTestLocation hitLocation, OLVListItem olvi ) : void

Update the given row using the given hot item information

UpdateNotificationSubscriptions ( IEnumerable collection ) : void

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.

WndProc ( Message &m ) : void

Override the basic message pump for this control

Private Methods

Method Description
AddCheckStateBitmap ( ImageList il, string key, CheckBoxState boxState ) : void
ApplyHyperlinkStyle ( int rowIndex, BrightIdeasSoftware.OLVListItem olvi ) : void
BuildBeforeSortingEventArgs ( OLVColumn column, SortOrder order ) : BrightIdeasSoftware.BeforeSortingEventArgs
BuildCellEvent ( BrightIdeasSoftware.CellEventArgs args, Point location ) : void
CalculateCellBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, ItemBoundsPortion portion ) : Rectangle
CalculateCheckState ( int state ) : CheckState
CalculateToggledCheckState ( OLVColumn column, CheckState currentState ) : CheckState
ColumnSelectMenuClosing ( object sender, System.Windows.Forms.ToolStripDropDownClosingEventArgs e ) : void
ColumnSelectMenuItemClicked ( object sender, ToolStripItemClickedEventArgs e ) : void
DoSort ( OLVColumn columnToSort, SortOrder order ) : void
FindGlassPanelForOverlay ( IOverlay overlay ) : GlassPanelForm
GetCheckedObject ( ) : object
GetCheckedObjects ( ) : ArrayList
GetFirstNonNullValue ( OLVColumn column ) : object

Get the first non-null value of the given column. At most 1000 rows will be considered.

GetSelectedObject ( ) : object
GetSelectedObjects ( ) : ArrayList
HandleHeaderRightClick ( ) : bool
HandleModelOnPropertyChanged ( object sender, PropertyChangedEventArgs propertyChangedEventArgs ) : void
HeaderToolTipShowingCallback ( object sender, ToolTipShowingEventArgs e ) : void

Allow the HeaderControl to call back into HandleHeaderToolTipShowing without making that method public

LowLevelScroll ( int dx, int dy ) : void

Scroll the ListView by the given deltas.

MakeResizedImage ( int width, int height, Image image, Color transparent ) : Bitmap

Return a bitmap of the given height x height, which shows the given image, centred.

MakeResizedImageList ( int width, int height, ImageList source ) : ImageList

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

MakeSubItem ( object rowObject, OLVColumn column ) : OLVListSubItem
MakeTriangleBitmap ( Size sz, Point pts ) : Bitmap
PrepareAlternateBackColors ( ) : void
RememberDisplayIndicies ( ) : void
RunWhenIdle ( EventHandler eventHandler ) : void
SetAllSubItemImages ( ) : void
SetGroupSpacing ( ) : void
SetupBaseImageList ( ) : void

Update our externally visible image list so it holds the same images as our shadow list, but sized correctly

ShouldShowOverlays ( ) : bool
ShowColumnCommandMenu ( int columnIndex, Point pt ) : void
ShowColumnSelectMenu ( Point pt ) : void
StateToString ( uint state ) : string
SubscribeNotifications ( IEnumerable models ) : void
ToggleSelectedRowCheckBoxes ( ) : void
UnsubscribeNotifications ( IEnumerable models ) : void

Method Details

AddDecoration() public method

Add the given decoration to those on this list and make it appear
A decoration scrolls with the listview. An overlay stays fixed in place.
public AddDecoration ( IDecoration decoration ) : void
decoration IDecoration The decoration
return void

AddItemsToColumnSelectMenu() protected method

Create the menu items that will allow columns to be choosen and add them to the given collection
protected AddItemsToColumnSelectMenu ( ToolStripItemCollection items ) : void
items System.Windows.Forms.ToolStripItemCollection
return void

AddObject() public method

Add the given model object to this control.
See AddObjects() for more details
public AddObject ( object modelObject ) : void
modelObject object The model object to be displayed
return void

AddObjects() public method

Add the given collection of model objects to this control.

The added objects will appear in their correct sort position, if sorting is active (i.e. if LastSortColumn 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.

public AddObjects ( ICollection modelObjects ) : void
modelObjects ICollection A collection of model objects
return void

AddOverlay() public method

Add the given overlay to those on this list and make it appear
public AddOverlay ( IOverlay overlay ) : void
overlay IOverlay The overlay
return void

ApplyCellStyle() protected method

Apply a style to a cell
protected ApplyCellStyle ( BrightIdeasSoftware.OLVListItem olvi, int columnIndex, IItemStyle style ) : void
olvi BrightIdeasSoftware.OLVListItem
columnIndex int
style IItemStyle
return void

ApplyExtendedStyles() protected method

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!).

protected ApplyExtendedStyles ( ) : void
return void

ApplyRowStyle() protected method

Apply a style to the given row
protected ApplyRowStyle ( BrightIdeasSoftware.OLVListItem olvi, IItemStyle style ) : void
olvi BrightIdeasSoftware.OLVListItem
style IItemStyle
return void

AutoResizeColumns() public method

Resize the columns to the maximum of the header width and the data.
public AutoResizeColumns ( ) : void
return void

BuildGroups() public method

Organise the view items into groups, based on the last sort column or the first column if there is no last sort column
public BuildGroups ( ) : void
return void

BuildGroups() public method

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.

public BuildGroups ( OLVColumn column, SortOrder order ) : void
column OLVColumn The column whose values should be used for sorting.
order SortOrder
return void

BuildGroups() public method

Organise the view items into groups, based on the given columns
This method does not trigger sorting events. Use BuildGroups() to do that
public BuildGroups ( OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder ) : void
groupByColumn OLVColumn What column will be used for grouping
groupByOrder SortOrder What ordering will be used for groups
column OLVColumn The column whose values should be used for sorting. Cannot be null
order SortOrder The order in which the values from column will be sorted
secondaryColumn OLVColumn When the values from 'column' are equal, use the values provided by this column
secondaryOrder SortOrder How will the secondary values be sorted
return void

BuildList() public method

Build/rebuild all the list view items in the list, preserving as much state as is possible
public BuildList ( ) : void
return void

BuildList() public method

Build/rebuild all the list view items in the list

Use this method in situations were the contents of the list is basically the same as previously.

public BuildList ( bool shouldPreserveState ) : void
shouldPreserveState bool If this is true, the control will try to preserve the selection, /// focused item, and the scroll position (see Remarks) ///
return void

CalculateCellBounds() public method

Return the bounds of the given cell
public CalculateCellBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex ) : Rectangle
item BrightIdeasSoftware.OLVListItem The row to be edited
subItemIndex int The index of the cell to be edited
return System.Drawing.Rectangle

CalculateCellEditorBounds() public method

Calculate the bounds of the edit control for the given item/column
public CalculateCellEditorBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
preferredSize System.Drawing.Size
return System.Drawing.Rectangle

CalculateCellEditorBoundsOwnerDrawn() protected method

Calculate the bounds of the edit control for the given item/column, when the listview is being owner drawn.
protected CalculateCellEditorBoundsOwnerDrawn ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Rectangle r, Size preferredSize ) : Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
r System.Drawing.Rectangle
preferredSize System.Drawing.Size
return System.Drawing.Rectangle

CalculateCellEditorBoundsStandard() protected method

Calculate the bounds of the edit control for the given item/column, when the listview is not being owner drawn.
protected CalculateCellEditorBoundsStandard ( BrightIdeasSoftware.OLVListItem item, int subItemIndex, Rectangle cellBounds, Size preferredSize ) : Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
cellBounds System.Drawing.Rectangle
preferredSize System.Drawing.Size
return System.Drawing.Rectangle

CalculateCellTextBounds() public method

Return the bounds of the given cell only until the edge of the current text
public CalculateCellTextBounds ( BrightIdeasSoftware.OLVListItem item, int subItemIndex ) : Rectangle
item BrightIdeasSoftware.OLVListItem The row to be edited
subItemIndex int The index of the cell to be edited
return System.Drawing.Rectangle

CalculateOwnerDrawnHitTest() protected method

Perform a hit test when the control is owner drawn. This hands off responsibility to the renderer.
protected CalculateOwnerDrawnHitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
return void

CalculateReasonableTileSize() public method

Give the listview a reasonable size of its tiles, based on the number of lines of information that each tile is going to display.
public CalculateReasonableTileSize ( ) : void
return void

CalculateStandardHitTest() protected method

Perform a hit test when the control is not owner drawn
protected CalculateStandardHitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
return void

CancelCellEdit() public method

Stop editing a cell and throw away any changes.
public CancelCellEdit ( ) : void
return void

CellEditor_Validating() protected method

Called when the cell editor could be about to lose focus. Time to commit the change
protected CellEditor_Validating ( object sender, CancelEventArgs e ) : void
sender object
e CancelEventArgs
return void

ChangeToFilteredColumns() public method

Rebuild this list for the given view
public ChangeToFilteredColumns ( View view ) : void
view View
return void

CheckIndeterminateObject() public method

Mark the given object as indeterminate check state
public CheckIndeterminateObject ( object modelObject ) : void
modelObject object The model object to be marked indeterminate
return void

CheckIndeterminateSubItem() public method

Put an indeterminate check into the check box at the given cell
public CheckIndeterminateSubItem ( object rowObject, OLVColumn column ) : void
rowObject object
column OLVColumn
return void

CheckObject() public method

Mark the given object as checked in the list
public CheckObject ( object modelObject ) : void
modelObject object The model object to be checked
return void

CheckObjects() public method

Mark the given objects as checked in the list
public CheckObjects ( IEnumerable modelObjects ) : void
modelObjects IEnumerable The model object to be checked
return void

CheckSubItem() public method

Put a check into the check box at the given cell
public CheckSubItem ( object rowObject, OLVColumn column ) : void
rowObject object
column OLVColumn
return void

CleanupCellEdit() protected method

Remove all trace of any existing cell edit operation
protected CleanupCellEdit ( bool expectingCellEdit ) : void
expectingCellEdit bool
return void

ClearHotItem() public method

Force the hot item to be recalculated
public ClearHotItem ( ) : void
return void

ClearObjects() public method

Remove all items from this list
public ClearObjects ( ) : void
return void

ClearPersistentCheckState() protected method

Forget any persistent checkbox state
protected ClearPersistentCheckState ( ) : void
return void

ClearUrlVisited() public method

Reset the memory of which URLs have been visited
public ClearUrlVisited ( ) : void
return void

CollectGroupingParameters() protected method

Collect and return all the variables that influence the creation of groups
protected CollectGroupingParameters ( OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder ) : BrightIdeasSoftware.GroupingParameters
groupByColumn OLVColumn
groupByOrder SortOrder
column OLVColumn
order SortOrder
secondaryColumn OLVColumn
secondaryOrder SortOrder
return BrightIdeasSoftware.GroupingParameters

ConfigureAutoComplete() public method

Configure the given text box to autocomplete unique values from the given column. At most 1000 rows will be considered.
public ConfigureAutoComplete ( TextBox tb, OLVColumn column ) : void
tb System.Windows.Forms.TextBox The textbox to configure
column OLVColumn The column used to calculate values
return void

ConfigureAutoComplete() public method

Configure the given text box to autocomplete unique values from the given column. At most 1000 rows will be considered.
public ConfigureAutoComplete ( TextBox tb, OLVColumn column, int maxRows ) : void
tb System.Windows.Forms.TextBox The textbox to configure
column OLVColumn The column used to calculate values
maxRows int Consider only this many rows
return void

ConfigureControl() protected method

Setup the given control to be a cell editor
protected ConfigureControl ( ) : void
return void

CopyObjectsToClipboard() public method

Copy a text and html representation of the given objects onto the clipboard.
public CopyObjectsToClipboard ( IList objectsToCopy ) : void
objectsToCopy IList
return void

CopySelectionToClipboard() public method

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.
public CopySelectionToClipboard ( ) : void
return void

CorrectSubItemColors() protected method

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
Cells drawn via BaseRenderer don't need this, but it is needed when an owner drawn cell uses DrawDefault=true
protected CorrectSubItemColors ( ListViewItem olvi ) : void
olvi ListViewItem The item whose subitems are to be corrected
return void

CreateCellToolTip() protected method

Create a ToolTipControl to manage the tooltip control used by the listview control
protected CreateCellToolTip ( ) : void
return void

CreateColumnFilter() public method

Create a filter that will enact all the filtering currently installed on the visible columns.
public CreateColumnFilter ( ) : IModelFilter
return IModelFilter

CreateGroups() protected method

Do the actual work of creating the given list of groups
protected CreateGroups ( IEnumerable groups ) : void
groups IEnumerable
return void

DeselectAll() public method

Deselect all rows in the listview
public DeselectAll ( ) : void
return void

Dispose() protected method

Dispose of any resources this instance has been using
protected Dispose ( bool disposing ) : void
disposing bool
return void

DoUnfreeze() protected method

Do the actual work required when the listview is unfrozen
protected DoUnfreeze ( ) : void
return void

DrawAllDecorations() protected method

Draw all the decorations
protected DrawAllDecorations ( Graphics g, List drawnItems ) : void
g Graphics A Graphics
drawnItems List The items that were redrawn and whose decorations should also be redrawn
return void

DropSinkCanDrop() public method

public DropSinkCanDrop ( object sender, OlvDropEventArgs e ) : void
sender object
e OlvDropEventArgs
return void

DropSinkDropped() public method

public DropSinkDropped ( object sender, OlvDropEventArgs e ) : void
sender object
e OlvDropEventArgs
return void

DropSinkModelCanDrop() public method

public DropSinkModelCanDrop ( object sender, ModelDropEventArgs e ) : void
sender object
e ModelDropEventArgs
return void

DropSinkModelDropped() public method

public DropSinkModelDropped ( object sender, ModelDropEventArgs e ) : void
sender object
e ModelDropEventArgs
return void

EditSubItem() public method

Begin an edit operation on the given cell.
This performs various sanity checks and passes off the real work to StartCellEdit().
public EditSubItem ( OLVListItem item, int subItemIndex ) : void
item OLVListItem The row to be edited
subItemIndex int The index of the cell to be edited
return void

EnableCustomSelectionColors() public method

Setup the list so it will draw selected rows using custom colours.
This method makes the list owner drawn, and ensures that all columns have at least a BaseRender installed.
public EnableCustomSelectionColors ( ) : void
return void

EnsureGroupVisible() public method

Scroll the listview so that the given group is at the top.

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 VirtualObjectListView.EnsureNthGroupVisible instead.

public EnsureGroupVisible ( ListViewGroup lvg ) : void
lvg ListViewGroup The group to be revealed
return void

EnsureModelVisible() public method

Ensure that the given model object is visible
public EnsureModelVisible ( Object modelObject ) : void
modelObject Object The model object to be revealed
return void

EnumerableToArray() public static method

Convert the given enumerable into an ArrayList as efficiently as possible

When we move to .NET 3.5, we can use LINQ and not need this method.

public static EnumerableToArray ( IEnumerable collection, bool alwaysCreate ) : ArrayList
collection IEnumerable The source collection
alwaysCreate bool If true, this method will always create a new /// collection.
return ArrayList

FillInValues() protected method

Fill in the given OLVListItem with values of the given row
protected FillInValues ( OLVListItem lvi, object rowObject ) : void
lvi OLVListItem the OLVListItem that is to be stuff with values
rowObject object the model object from which values will be taken
return void

FilterObjects() protected method

Do the actual work of filtering
protected FilterObjects ( IEnumerable originalObjects, IModelFilter aModelFilter, IListFilter aListFilter ) : IEnumerable
originalObjects IEnumerable
aModelFilter IModelFilter
aListFilter IListFilter
return IEnumerable

FindMatchInRange() protected method

Find the first row in the given range of rows that prefix matches the string value of the given column.
protected FindMatchInRange ( string text, int first, int last, OLVColumn column ) : int
text string
first int
last int
column OLVColumn
return int

FindMatchingRow() public method

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 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.
public FindMatchingRow ( string text, int start, SearchDirectionHint direction ) : int
text string The text to be prefix matched
start int The index of the first row to consider
direction SearchDirectionHint Which direction should be searched?
return int

FinishCellEdit() public method

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.
public FinishCellEdit ( ) : void
return void

FinishCellEdit() public method

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.
public FinishCellEdit ( bool expectingCellEdit ) : void
expectingCellEdit bool True if it is likely that another cell is going to be /// edited immediately after this cell finishes editing
return void

ForceSubItemImagesExStyle() protected method

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.
protected ForceSubItemImagesExStyle ( ) : void
return void

Freeze() public method

Freeze the listview so that it no longer updates itself.
Freeze()/Unfreeze() calls nest correctly
public Freeze ( ) : void
return void

GetActualImageIndex() protected method

Convert the given image selector to an index into our image list. Return -1 if that's not possible
protected GetActualImageIndex ( Object imageSelector ) : int
imageSelector Object
return int

GetCellEditor() protected method

Return a control that can be used to edit the value of the given cell.
protected GetCellEditor ( OLVListItem item, int subItemIndex ) : Control
item OLVListItem The row to be edited
subItemIndex int The index of the cell to be edited
return Control

GetCellToolTip() public method

Return the tooltip that should be shown when the mouse is hovered over the given cell
public GetCellToolTip ( int columnIndex, int rowIndex ) : String
columnIndex int The column index whose tool tip is to be fetched
rowIndex int The row index whose tool tip is to be fetched
return String

GetCheckState() protected method

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.
protected GetCheckState ( Object modelObject ) : CheckState?
modelObject Object
return CheckState?

GetColumn() public method

Return the column at the given index
public GetColumn ( int index ) : OLVColumn
index int Index of the column to be returned
return OLVColumn

GetColumn() public method

Return the column at the given title.
public GetColumn ( string name ) : OLVColumn
name string Name of the column to be returned
return OLVColumn

GetControlValue() protected method

Return the value that the given control is showing
protected GetControlValue ( Control control ) : Object
control Control
return Object

GetDisplayOrderOfItemIndex() public method

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.
public GetDisplayOrderOfItemIndex ( int itemIndex ) : int
itemIndex int
return int

GetFilteredColumns() public method

Return a collection of columns that are visible to the given view. Only Tile and Details have columns; all other views have 0 columns.
public GetFilteredColumns ( View view ) : List
view View Which view are the columns being calculate for?
return List

GetHeaderToolTip() public method

Return the tooltip that should be shown when the mouse is hovered over the given column
public GetHeaderToolTip ( int columnIndex ) : String
columnIndex int The column index whose tool tip is to be fetched
return String

GetItem() public method

Return the item at the given index
public GetItem ( int index ) : OLVListItem
index int Index of the item to be returned
return OLVListItem

GetItemAt() public method

Find the item and column that are under the given co-ords
public GetItemAt ( int x, int y, OLVColumn &hitColumn ) : OLVListItem
x int X co-ord
y int Y co-ord
hitColumn OLVColumn The column under the given point
return OLVListItem

GetItemCount() public method

Return the number of items in the list
public GetItemCount ( ) : int
return int

GetLastItemInDisplayOrder() public method

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.
public GetLastItemInDisplayOrder ( ) : OLVListItem
return OLVListItem

GetModelObject() public method

Return the model object at the given index
public GetModelObject ( int index ) : object
index int Index of the model object to be returned
return object

GetNextItem() public method

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.
public GetNextItem ( OLVListItem itemToFind ) : OLVListItem
itemToFind OLVListItem The item that is before the item that is returned, or null
return OLVListItem

GetNthItemInDisplayOrder() public method

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.
public GetNthItemInDisplayOrder ( int n ) : OLVListItem
n int
return OLVListItem

GetPersistentCheckState() protected method

Gets the checkedness of the given model.
protected GetPersistentCheckState ( object model ) : CheckState
model object The model
return CheckState

GetPreviousItem() public method

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.
public GetPreviousItem ( OLVListItem itemToFind ) : OLVListItem
itemToFind OLVListItem The item that is before the item that is returned
return OLVListItem

GetSubItem() public method

Return the sub item at the given index/column
public GetSubItem ( int index, int columnIndex ) : OLVListSubItem
index int Index of the item to be returned
columnIndex int Index of the subitem to be returned
return OLVListSubItem

HandleApplicationIdle() protected method

The application is idle. Trigger a SelectionChanged event.
protected HandleApplicationIdle ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

HandleApplicationIdleResizeColumns() protected method

The application is idle. Trigger a SelectionChanged event.
protected HandleApplicationIdleResizeColumns ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

HandleBeginScroll() protected method

Handle the BeginScroll listview notification
protected HandleBeginScroll ( Message &m ) : bool
m Message
return bool

HandleCellToolTipShowing() protected method

The cell tooltip control wants information about the tool tip that it should show.
protected HandleCellToolTipShowing ( object sender, ToolTipShowingEventArgs e ) : void
sender object
e ToolTipShowingEventArgs
return void

HandleChar() protected method

Handle the search for item m if possible.
protected HandleChar ( Message &m ) : bool
m Message The m to be processed
return bool

HandleColumnClick() protected method

Event handler for the column click event
protected HandleColumnClick ( object sender, ColumnClickEventArgs e ) : void
sender object
e ColumnClickEventArgs
return void

HandleColumnWidthChanged() protected method

When the column widths change, resize the space filling columns
protected HandleColumnWidthChanged ( object sender, ColumnWidthChangedEventArgs e ) : void
sender object
e ColumnWidthChangedEventArgs
return void

HandleColumnWidthChanging() protected method

When the column widths are changing, resize the space filling columns
protected HandleColumnWidthChanging ( object sender, ColumnWidthChangingEventArgs e ) : void
sender object
e ColumnWidthChangingEventArgs
return void

HandleContextMenu() protected method

The user wants to see the context menu.
We want to ignore context menu requests that are triggered by right clicks on the header
protected HandleContextMenu ( Message &m ) : bool
m Message The windows m
return bool

HandleCustomDraw() protected method

Handle the Custom draw series of notifications
protected HandleCustomDraw ( Message &m ) : bool
m Message The message
return bool

HandleDestroy() protected method

Handle the underlying control being destroyed
protected HandleDestroy ( Message &m ) : bool
m Message
return bool

HandleEndScroll() protected method

Handle the EndScroll listview notification
protected HandleEndScroll ( Message &m ) : bool
m Message
return bool

HandleFindItem() protected method

Handle the search for item m if possible.
protected HandleFindItem ( Message &m ) : bool
m Message The m to be processed
return bool

HandleGroupInfo() protected method

Handle the Group Info series of notifications
protected HandleGroupInfo ( Message &m ) : bool
m Message The message
return bool

HandleHeaderRightClick() protected method

The user has right clicked on the column headers. Do whatever is required
protected HandleHeaderRightClick ( int columnIndex ) : bool
columnIndex int
return bool

HandleHeaderToolTipShowing() protected method

The header tooltip control wants information about the tool tip that it should show.
protected HandleHeaderToolTipShowing ( object sender, ToolTipShowingEventArgs e ) : void
sender object
e ToolTipShowingEventArgs
return void

HandleKeyDown() protected method

Handle a key down message
protected HandleKeyDown ( Message &m ) : bool
m Message
return bool

HandleLButtonDoubleClick() protected method

Catch the Left Button double click event.
protected HandleLButtonDoubleClick ( Message &m ) : bool
m Message The m to be processed
return bool

HandleLButtonDown() protected method

Catch the Left Button down event.
protected HandleLButtonDown ( Message &m ) : bool
m Message The m to be processed
return bool

HandleLButtonUp() protected method

Catch the Left Button up event.
protected HandleLButtonUp ( Message &m ) : bool
m Message The m to be processed
return bool

HandleLayout() protected method

When the size of the control changes, we have to resize our space filling columns.
protected HandleLayout ( object sender, LayoutEventArgs e ) : void
sender object
e LayoutEventArgs
return void

HandleLinkClick() protected method

Handle the LinkClick listview notification
protected HandleLinkClick ( Message &m ) : bool
m Message
return bool

HandleMouseMove() protected method

Catch the MouseMove event.
protected HandleMouseMove ( Message &m ) : bool
m Message The m to be processed
return bool

HandleNotify() protected method

In the notification messages, we handle attempts to change the width of our columns
protected HandleNotify ( Message &m ) : bool
m Message The m to be processed
return bool

HandlePaint() protected method

Handle the WM_PAINT event
protected HandlePaint ( Message &m ) : bool
m Message
return bool

HandlePostPaint() protected method

Perform any steps needed after painting the control
protected HandlePostPaint ( ) : void
return void

HandlePrePaint() protected method

Perform any steps needed before painting the control
protected HandlePrePaint ( ) : void
return void

HandleRButtonDoubleClick() protected method

Catch the right Button double click event.
protected HandleRButtonDoubleClick ( Message &m ) : bool
m Message The m to be processed
return bool

HandleRButtonDown() protected method

Catch the Right Button down event.
protected HandleRButtonDown ( Message &m ) : bool
m Message The m to be processed
return bool

HandleReflectNotify() protected method

Handle notifications that have been reflected back from the parent window
protected HandleReflectNotify ( Message &m ) : bool
m Message The m to be processed
return bool

HandleWindowPosChanging() protected method

Handle the window position changing.
protected HandleWindowPosChanging ( Message &m ) : bool
m Message The m to be processed
return bool

HasDecoration() public method

Is the given decoration shown on this list
public HasDecoration ( IDecoration decoration ) : bool
decoration IDecoration The overlay
return bool

HasOverlay() public method

Is the given overlay shown on this list?
public HasOverlay ( IOverlay overlay ) : bool
overlay IOverlay The overlay
return bool

HideOverlays() public method

Hide any overlays.
This is only a temporary hiding -- the overlays will be shown the next time the ObjectListView redraws.
public HideOverlays ( ) : void
return void

HitTest() public method

Calculate what item is under the given point?
public HitTest ( int x, int y ) : ListViewHitTestInfo
x int
y int
return ListViewHitTestInfo

ISupportInitialize() public method

public ISupportInitialize ( ) : void
return void

IndexOf() public method

Find the given model object within the listview and return its index
public IndexOf ( Object modelObject ) : int
modelObject Object The model object to be found
return int

InitializeCheckBoxImages() protected method

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.
protected InitializeCheckBoxImages ( ) : void
return void

InitializeEmptyListMsgOverlay() protected method

Create and configure the empty list msg overlay
protected InitializeEmptyListMsgOverlay ( ) : void
return void

InitializeStandardOverlays() protected method

Initialize the standard image and text overlays
protected InitializeStandardOverlays ( ) : void
return void

InitializeStateImageList() protected method

Initialize the state image list with the required checkbox images
protected InitializeStateImageList ( ) : void
return void

InsertObjects() public method

Insert the given collection of objects before the given position

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.

public InsertObjects ( int index, ICollection modelObjects ) : void
index int Where to insert the objects
modelObjects ICollection The objects to be inserted
return void

IsChecked() public method

Return true of the given object is checked
If the given object is not in the list, this method returns false.
public IsChecked ( object modelObject ) : bool
modelObject object The model object whose checkedness is returned
return bool

IsCheckedIndeterminate() public method

Return true of the given object is indeterminately checked
If the given object is not in the list, this method returns false.
public IsCheckedIndeterminate ( object modelObject ) : bool
modelObject object The model object whose checkedness is returned
return bool

IsEnumerableEmpty() public static method

public static IsEnumerableEmpty ( IEnumerable collection ) : bool
collection IEnumerable
return bool

IsSelected() public method

Return true if the row representing the given model is selected
public IsSelected ( object model ) : bool
model object The model object to look for
return bool

IsSubItemChecked() public method

Is there a check at the check box at the given cell
public IsSubItemChecked ( object rowObject, OLVColumn column ) : bool
rowObject object
column OLVColumn
return bool

IsUrlVisited() public method

Has the given URL been visited?
public IsUrlVisited ( string url ) : bool
url string The string to be consider
return bool

LowLevelHitTest() protected method

Perform a hit test using the Windows control's SUBITEMHITTEST message. This provides information about group hits that the standard ListView.HitTest() does not.
protected LowLevelHitTest ( int x, int y ) : OlvListViewHitTestInfo
x int
y int
return OlvListViewHitTestInfo

MakeColumnCommandMenu() public method

Append the column selection menu items to the given menu strip.
public MakeColumnCommandMenu ( ToolStripDropDown strip, int columnIndex ) : ToolStripDropDown
strip ToolStripDropDown The menu to which the items will be added.
columnIndex int
return ToolStripDropDown

MakeColumnSelectMenu() public method

Append the column selection menu items to the given menu strip.
public MakeColumnSelectMenu ( ToolStripDropDown strip ) : ToolStripDropDown
strip ToolStripDropDown The menu to which the items will be added.
return ToolStripDropDown

MakeDefaultCellEditor() protected method

Return a TextBox that can be used as a default cell editor.
protected MakeDefaultCellEditor ( OLVColumn column ) : Control
column OLVColumn What column does the cell belong to?
return Control

MakeFilteringMenu() public method

Create a Filtering menu
public MakeFilteringMenu ( ToolStripDropDown strip, int columnIndex ) : ToolStripDropDown
strip ToolStripDropDown
columnIndex int
return ToolStripDropDown

MakeGroups() protected method

Make a list of groups that should be shown according to the given parameters
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.
protected MakeGroups ( GroupingParameters parms ) : IList
parms GroupingParameters
return IList

MakeHeaderRightClickMenu() protected method

Create the menu that should be displayed when the user right clicks on the given column header.
protected MakeHeaderRightClickMenu ( int columnIndex ) : ToolStripDropDown
columnIndex int Index of the column that was right clicked. /// This can be negative, which indicates a click outside of any header.
return ToolStripDropDown

MakeSortIndicatorImages() protected method

If the sort indicator images don't already exist, this method will make and install them
protected MakeSortIndicatorImages ( ) : void
return void

MarkUrlVisited() public method

Remember that the given URL has been visited
This does not cause the control be redrawn
public MarkUrlVisited ( string url ) : void
url string The url to be remembered
return void

ModelToItem() public method

Return the OLVListItem that displays the given model object
This method has O(n) performance.
public ModelToItem ( object modelObject ) : OLVListItem
modelObject object The modelObject whose item is to be found
return OLVListItem

MoveObjects() public method

Move the given collection of objects to the given index.
This operation only makes sense on non-grouped ObjectListViews.
public MoveObjects ( int index, ICollection modelObjects ) : void
index int
modelObjects ICollection
return void

ObjectListView() public method

Create an ObjectListView
public ObjectListView ( ) : System
return System

ObjectsToHtml() public method

Return a html representation of the given objects
public ObjectsToHtml ( IList objectsToConvert ) : string
objectsToConvert IList
return string

OlvHitTest() public method

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
public OlvHitTest ( int x, int y ) : OlvListViewHitTestInfo
x int
y int
return OlvListViewHitTestInfo

OnColumnReordered() protected method

Override the OnColumnReordered method to do what we want
protected OnColumnReordered ( ColumnReorderedEventArgs e ) : void
e ColumnReorderedEventArgs
return void

OnControlCreated() protected method

This method is called after the control has been fully created.
protected OnControlCreated ( ) : void
return void

OnDragDrop() protected method

protected OnDragDrop ( DragEventArgs args ) : void
args DragEventArgs
return void

OnDragEnter() protected method

protected OnDragEnter ( DragEventArgs args ) : void
args DragEventArgs
return void

OnDragLeave() protected method

protected OnDragLeave ( EventArgs e ) : void
e EventArgs
return void

OnDragOver() protected method

protected OnDragOver ( DragEventArgs args ) : void
args DragEventArgs
return void

OnDrawColumnHeader() protected method

Owner draw the column header
protected OnDrawColumnHeader ( DrawListViewColumnHeaderEventArgs e ) : void
e DrawListViewColumnHeaderEventArgs
return void

OnDrawItem() protected method

Owner draw the item
protected OnDrawItem ( DrawListViewItemEventArgs e ) : void
e DrawListViewItemEventArgs
return void

OnDrawSubItem() protected method

Owner draw a single subitem
protected OnDrawSubItem ( DrawListViewSubItemEventArgs e ) : void
e DrawListViewSubItemEventArgs
return void

OnGiveFeedback() protected method

protected OnGiveFeedback ( GiveFeedbackEventArgs args ) : void
args GiveFeedbackEventArgs
return void

OnHandleCreated() protected method

Called when the handle of the underlying control is created
protected OnHandleCreated ( EventArgs e ) : void
e EventArgs
return void

OnItemDrag() protected method

protected OnItemDrag ( ItemDragEventArgs e ) : void
e ItemDragEventArgs
return void

OnMouseDown() protected method

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.
protected OnMouseDown ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnMouseLeave() protected method

When the mouse leaves the control, remove any hot item highlighting
protected OnMouseLeave ( EventArgs e ) : void
e EventArgs
return void

OnMouseMove() protected method

When the mouse moves, we might need to change the hot item.
protected OnMouseMove ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnMouseUp() protected method

Check to see if we need to start editing a cell
protected OnMouseUp ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnQueryContinueDrag() protected method

protected OnQueryContinueDrag ( QueryContinueDragEventArgs args ) : void
args QueryContinueDragEventArgs
return void

OnRightMouseUp() protected method

The user right clicked on the control
protected OnRightMouseUp ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnSelectedIndexChanged() protected method

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
protected OnSelectedIndexChanged ( EventArgs e ) : void
e EventArgs
return void

PauseAnimations() public method

Pause (or unpause) all animations in the list
public PauseAnimations ( bool isPause ) : void
isPause bool true to pause, false to unpause
return void

PossibleFinishCellEditing() public method

If a cell edit is in progress, finish the edit.
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.
public PossibleFinishCellEditing ( ) : bool
return bool

PossibleFinishCellEditing() public method

If a cell edit is in progress, finish the edit.
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.
public PossibleFinishCellEditing ( bool expectingCellEdit ) : bool
expectingCellEdit bool True if it is likely that another cell is going to be /// edited immediately after this cell finishes editing
return bool

PostProcessOneRow() protected method

Do the work required after one item in a listview have been created
protected PostProcessOneRow ( int rowIndex, int displayIndex, OLVListItem olvi ) : void
rowIndex int
displayIndex int
olvi OLVListItem
return void

PostProcessRows() protected method

Do the work required after the items in a listview have been created
protected PostProcessRows ( ) : void
return void

ProcessDialogKey() protected method

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.
protected ProcessDialogKey ( Keys keyData ) : bool
keyData Keys
return bool

ProcessHyperlinkClicked() protected method

Tell the world that a hyperlink was clicked and if the event isn't handled, do the default processing.
protected ProcessHyperlinkClicked ( CellClickEventArgs e ) : void
e CellClickEventArgs
return void

ProcessLButtonDoubleClick() protected method

Handle a mouse double click at the given hit test location
Subclasses can override this to do something unique
protected ProcessLButtonDoubleClick ( OlvListViewHitTestInfo hti ) : bool
hti OlvListViewHitTestInfo
return bool

ProcessLButtonDown() protected method

Handle a left mouse down at the given hit test location
Subclasses can override this to do something unique
protected ProcessLButtonDown ( OlvListViewHitTestInfo hti ) : bool
hti OlvListViewHitTestInfo
return bool

ProcessRButtonDoubleClick() protected method

Handle a right mouse double click at the given hit test location
Subclasses can override this to do something unique
protected ProcessRButtonDoubleClick ( OlvListViewHitTestInfo hti ) : bool
hti OlvListViewHitTestInfo
return bool

ProcessRButtonDown() protected method

Handle a left mouse down at the given hit test location
Subclasses can override this to do something unique
protected ProcessRButtonDown ( OlvListViewHitTestInfo hti ) : bool
hti OlvListViewHitTestInfo
return bool

PutCheckState() protected method

Record the change of checkstate for the given object in the model. This does not update the UI -- only the model
protected PutCheckState ( Object modelObject, CheckState state ) : CheckState
modelObject Object
state CheckState
return CheckState

RebuildColumns() public method

Rebuild the columns based upon its current view and column visibility settings
public RebuildColumns ( ) : void
return void

RefreshHotItem() public method

Force the hot item to be recalculated
public RefreshHotItem ( ) : void
return void

RefreshItem() public method

Update the 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
public RefreshItem ( OLVListItem olvi ) : void
olvi OLVListItem
return void

RefreshObject() public method

Update the rows that are showing the given objects
This method does not resort or regroup the view.
public RefreshObject ( object modelObject ) : void
modelObject object
return void

RefreshObjects() public method

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.

public RefreshObjects ( IList modelObjects ) : void
modelObjects IList
return void

RefreshOverlay() public method

Refresh the display of just one overlays
public RefreshOverlay ( IOverlay overlay ) : void
overlay IOverlay
return void

RefreshOverlays() public method

Refresh the display of the overlays
public RefreshOverlays ( ) : void
return void

RefreshSelectedObjects() public method

Update the rows that are selected
This method does not resort or regroup the view.
public RefreshSelectedObjects ( ) : void
return void

RemoveDecoration() public method

Remove the given decoration from this list
public RemoveDecoration ( IDecoration decoration ) : void
decoration IDecoration The decoration to remove
return void

RemoveObject() public method

Remove the given model object from the ListView
See RemoveObjects() for more details

This method is thread-safe.

public RemoveObject ( object modelObject ) : void
modelObject object The model to be removed
return void

RemoveObjects() public method

Remove all of the given objects from the control.

Nulls and model objects that are not in the ListView are silently ignored.

This method is thread-safe.

public RemoveObjects ( ICollection modelObjects ) : void
modelObjects ICollection Collection of objects to be removed
return void

RemoveOverlay() public method

Remove the given overlay to those on this list
public RemoveOverlay ( IOverlay overlay ) : void
overlay IOverlay The overlay
return void

Reset() public method

Make the list forget everything -- all rows and all columns
Use ClearObjects if you want to remove just the rows.
public Reset ( ) : void
return void

ResetColumnFiltering() public method

Remove all column filtering.
public ResetColumnFiltering ( ) : void
return void

ResizeFreeSpaceFillingColumns() protected method

Resize our space filling columns so they fill any unoccupied width in the control
protected ResizeFreeSpaceFillingColumns ( ) : void
return void

ResizeFreeSpaceFillingColumns() protected method

Resize our space filling columns so they fill any unoccupied width in the control
protected ResizeFreeSpaceFillingColumns ( int freeSpace ) : void
freeSpace int
return void

RestoreState() public method

Restore the state of the control from the given string, which must have been produced by SaveState()
public RestoreState ( byte state ) : bool
state byte A byte array returned from SaveState()
return bool

SaveState() public method

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.

public SaveState ( ) : byte[]
return byte[]

SelectAll() public method

Select all rows in the listview
public SelectAll ( ) : void
return void

SelectObject() public method

Select the row that is displaying the given model object, in addition to any current selection.
Use the SelectedObject property to deselect all other rows
public SelectObject ( object modelObject ) : void
modelObject object The object to be selected
return void

SelectObject() public method

Select the row that is displaying the given model object, in addition to any current selection.
Use the SelectedObject property to deselect all other rows
public SelectObject ( object modelObject, bool setFocus ) : void
modelObject object The object to be selected
setFocus bool Should the object be focused as well?
return void

SelectObjects() public method

Select the rows that is displaying any of the given model object. All other rows are deselected.
public SelectObjects ( IList modelObjects ) : void
modelObjects IList A collection of model objects
return void

SetControlValue() protected method

Try to give the given value to the provided control. Fall back to assigning a string if the value assignment fails.
protected SetControlValue ( Control control, Object value, String stringValue ) : void
control Control A control
value Object The value to be given to the control
stringValue String The string to be given if the value doesn't work
return void

SetNativeBackgroundImage() public method

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 SetNativeBackgroundWatermark. Make sure those limitations are understood before using the method.

This is very similar to setting the System.Windows.Forms.Control.BackgroundImage 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.

public SetNativeBackgroundImage ( Image image, int xOffset, int yOffset ) : void
image Image The image to be drawn. If null, any existing image will be removed.
xOffset int The horizontal percentage where the image will be placed. 0 is absolute left, 100 is absolute right.
yOffset int The vertical percentage where the image will be placed.
return void

SetNativeBackgroundTiledImage() public method

Set the given image to be the tiled background of the ListView.

This has the same limitations as described in SetNativeBackgroundWatermark and SetNativeBackgroundImage. Make sure those limitations are understood before using the method.

public SetNativeBackgroundTiledImage ( Image image ) : void
image Image The image to be drawn. If null, any existing image will be removed.
return void

SetNativeBackgroundWatermark() public method

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.

public SetNativeBackgroundWatermark ( Image image ) : void
image Image The image to be drawn. If null, any existing image will be removed.
return void

SetObjectCheckedness() protected method

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.
protected SetObjectCheckedness ( object modelObject, CheckState state ) : void
modelObject object
state CheckState
return void

SetObjects() public method

Set the collection of objects that will be shown in this list view.
The list is updated immediately
public SetObjects ( IEnumerable collection ) : void
collection IEnumerable The objects to be displayed
return void

SetObjects() public method

Set the collection of objects that will be shown in this list view.
The list is updated immediately
public SetObjects ( IEnumerable collection, bool preserveState ) : void
collection IEnumerable The objects to be displayed
preserveState bool Should the state of the list be preserved as far as is possible.
return void

SetPersistentCheckState() protected method

Remember the check state of the given model object
protected SetPersistentCheckState ( object model, CheckState state ) : CheckState
model object The model to be remembered
state CheckState The model's checkedness
return CheckState

SetSubItemImage() public method

Set the subitem image natively
public SetSubItemImage ( int rowIndex, int subItemIndex, OLVListSubItem subItem, bool shouldClearImages ) : void
rowIndex int
subItemIndex int
subItem OLVListSubItem
shouldClearImages bool
return void

SetSubItemImages() protected method

Tell the underlying list control which images to show against the subitems
protected SetSubItemImages ( int rowIndex, OLVListItem item ) : void
rowIndex int the index at which the item occurs
item OLVListItem the item whose subitems are to be set
return void

SetSubItemImages() protected method

Tell the underlying list control which images to show against the subitems
protected SetSubItemImages ( int rowIndex, OLVListItem item, bool shouldClearImages ) : void
rowIndex int the index at which the item occurs
item OLVListItem the item whose subitems are to be set
shouldClearImages bool will existing images be cleared if no new image is provided?
return void

SetupSubItemCheckBoxes() public method

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.
public SetupSubItemCheckBoxes ( ) : void
return void

ShouldStartCellEdit() protected method

Should we start editing the cell in response to the given mouse button event?
protected ShouldStartCellEdit ( MouseEventArgs e ) : bool
e MouseEventArgs
return bool

ShowHeaderRightClickMenu() protected method

Show a menu that is appropriate when the given column header is clicked.
protected ShowHeaderRightClickMenu ( int columnIndex, Point pt ) : bool
columnIndex int The index of the header that was clicked. This /// can be -1, indicating that the header was clicked outside of a column
pt Point Where should the menu be shown
return bool

ShowOverlays() public method

Make sure that any overlays are visible.
public ShowOverlays ( ) : void
return void

ShowSortIndicator() public method

Put a sort indicator next to the text of the sort column
public ShowSortIndicator ( ) : void
return void

ShowSortIndicator() protected method

Put a sort indicator next to the text of the given given column
protected ShowSortIndicator ( OLVColumn columnToSort, SortOrder sortOrder ) : void
columnToSort OLVColumn The column to be marked
sortOrder SortOrder The sort order in effect on that column
return void

Sort() public method

Sort the items by the last sort column and order
public Sort ( ) : void
return void

Sort() public method

Sort the items in the list view by the values in the given column and the last sort order
public Sort ( OLVColumn columnToSort ) : void
columnToSort OLVColumn The column whose values will be used for the sorting
return void

Sort() public method

Sort the items in the list view by the values in the given column and by the given order.
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.
public Sort ( OLVColumn columnToSort, SortOrder order ) : void
columnToSort OLVColumn The column whose values will be used for the sorting. /// If null, the first column will be used.
order SortOrder The ordering to be used for sorting. If this is None, /// this.Sorting and then SortOrder.Ascending will be used
return void

Sort() public method

Sort the items in the list view by the values in the given column and the last sort order
public Sort ( int columnToSortIndex ) : void
columnToSortIndex int The index of the column whose values will be used for the sorting
return void

Sort() public method

Sort the items in the list view by the values in the given column and the last sort order
public Sort ( string columnToSortName ) : void
columnToSortName string The name of the column whose values will be used for the sorting
return void

StandardHyperlinkClickedProcessing() protected method

Do the default processing for a hyperlink clicked event, which is to try and open the url.
protected StandardHyperlinkClickedProcessing ( HyperlinkClickedEventArgs args ) : void
args HyperlinkClickedEventArgs
return void

StartCellEdit() public method

Really start an edit operation on a given cell. The parameters are assumed to be sane.
public StartCellEdit ( OLVListItem item, int subItemIndex ) : void
item OLVListItem The row to be edited
subItemIndex int The index of the cell to be edited
return void

TakeOwnershipOfObjects() protected method

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.

protected TakeOwnershipOfObjects ( ) : void
return void

ToggleCheckObject() public method

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 ...
public ToggleCheckObject ( object modelObject ) : void
modelObject object The model object to be checked
return void

ToggleSubItemCheckBox() public method

Toggle the check at the check box of the given cell
public ToggleSubItemCheckBox ( object rowObject, OLVColumn column ) : void
rowObject object
column OLVColumn
return void

TriggerFormatRowEvent() protected method

Trigger FormatRow and possibly FormatCell events for the given item
protected TriggerFormatRowEvent ( int rowIndex, int displayIndex, OLVListItem olvi ) : void
rowIndex int
displayIndex int
olvi OLVListItem
return void

TriggerGroupExpandCollapse() protected method

Trigger a GroupExpandCollapse event and return true if the action was cancelled
protected TriggerGroupExpandCollapse ( OLVGroup group ) : bool
group OLVGroup
return bool

UnapplyHotItem() protected method

Remove hot item styling from the given row
protected UnapplyHotItem ( int index ) : void
index int
return void

UncheckObject() public method

Mark the given object as unchecked in the list
public UncheckObject ( object modelObject ) : void
modelObject object The model object to be unchecked
return void

UncheckObjects() public method

Mark the given objects as unchecked in the list
public UncheckObjects ( IEnumerable modelObjects ) : void
modelObjects IEnumerable The model object to be checked
return void

UncheckSubItem() public method

Uncheck the check at the given cell
public UncheckSubItem ( object rowObject, OLVColumn column ) : void
rowObject object
column OLVColumn
return void

Unfreeze() public method

Unfreeze the listview. If this call is the outermost Unfreeze(), the contents of the listview will be rebuilt.
Freeze()/Unfreeze() calls nest correctly
public Unfreeze ( ) : void
return void

Unsort() public method

Remove any sorting and revert to the given order of the model objects
public Unsort ( ) : void
return void

UpdateCellToolTipHandle() protected method

Update the handle used by our cell tooltip to be the tooltip used by the underlying Windows listview control.
protected UpdateCellToolTipHandle ( ) : void
return void

UpdateColumnFiltering() public method

Update the filtering of this ObjectListView based on the value filtering defined in each column
public UpdateColumnFiltering ( ) : void
return void

UpdateFiltering() protected method

When some setting related to filtering changes, this method is called.
protected UpdateFiltering ( ) : void
return void

UpdateHotItem() protected method

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
protected UpdateHotItem ( OlvListViewHitTestInfo hti ) : void
hti OlvListViewHitTestInfo
return void

UpdateHotItem() protected method

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
protected UpdateHotItem ( Point pt ) : void
pt Point Where is the mouse?
return void

UpdateHotRow() protected method

Update the given row using the current hot item information
protected UpdateHotRow ( OLVListItem olvi ) : void
olvi OLVListItem
return void

UpdateHotRow() protected method

Update the given row using the given hot item information
protected UpdateHotRow ( int rowIndex, int columnIndex, HitTestLocation hitLocation, OLVListItem olvi ) : void
rowIndex int
columnIndex int
hitLocation HitTestLocation
olvi OLVListItem
return void

UpdateNotificationSubscriptions() protected method

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.
protected UpdateNotificationSubscriptions ( IEnumerable collection ) : void
collection IEnumerable
return void

WndProc() protected method

Override the basic message pump for this control
protected WndProc ( Message &m ) : void
m Message
return void

Property Details

EditorRegistry public_oe static_oe property

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.
public static EditorRegistry EditorRegistry
return EditorRegistry

SortAscendingImage public_oe static_oe property

Gets or sets the image that will be place next to the Sort Ascending command
public static Bitmap SortAscendingImage
return Bitmap

SortDescendingImage public_oe static_oe property

Gets or sets the image that will be placed next to the Sort Descending command
public static Bitmap SortDescendingImage
return Bitmap