Click or drag to resize

ShellViewColumns Class

Class representing a collection of ShellViewColumns. It serves to control the visible columns in supported controls. Not supported on Windows XP.
Inheritance Hierarchy
SystemObject
  Jam.ShellShellViewColumns

Namespace: Jam.Shell
Assembly: ShellBrowser.Core (in ShellBrowser.Core.dll) Version: 7.2
Syntax
public class ShellViewColumns : IList<ShellViewColumn>, 
	ICollection<ShellViewColumn>, IEnumerable<ShellViewColumn>, IEnumerable, 
	INotifyCollectionChanged

The ShellViewColumns type exposes the following members.

Properties
 NameDescription
Public propertyCount Gets the number of elements contained in the ICollectionT.
Public propertyIsReadOnly Gets a value indicating whether the ICollectionT is read-only.
Public propertyItem Gets or sets the element at the specified index.
Public propertySortBy Gets or sets the column the view is sorted by.
Public propertySortDirection Gets or sets the sort direction.
Top
Methods
 NameDescription
Public methodCode exampleAdd(SHCOLUMNID) Adds the specified column at the last position.
Public methodAdd(ShellViewColumn) Adds a column to the collection.
Public methodAutoSize Resizes all columns to the auto-size width.
Public methodCode exampleClear Removes all items from the ICollectionT.
Public methodContains(SHCOLUMNID) Determines whether the passed column is contained in the collection.
Public methodContains(ShellViewColumn) Determines whether the ICollectionT contains a specific value.
Public methodCopyTo Copies the entire list to the array passed, starting at the passed index of the target array.
Public methodDefaultSize Resizes all columns to the default-size width.
Protected methodGetColumnName Gets the caption of the column with the passed column key.
Protected methodGetColumnWidth Returns the width of the column identified by the passed id.
Public methodGetEnumerator Returns an enumerator that iterates through the collection.
Public methodGetSHColumnIds Returns the columns the keys of the columns in collection.
Public methodHide Removes the given column from the current view.
Public methodIndexOf(SHCOLUMNID) Returns the index of the column with the passed SHCOLUMNID.
Public methodIndexOf(ShellViewColumn) Determines the index of a specific item in the IListT.
Public methodInsert(Int32, SHCOLUMNID) Inserts a new column representing the passed SHCOLUMNID at the passed index.
Public methodInsert(Int32, ShellViewColumn) Inserts an item to the IListT at the specified index.
Public methodRemove(SHCOLUMNID) Removes the specified column.
Public methodCode exampleRemove(ShellViewColumn) Removes the first occurrence of a specific object from the ICollectionT.
Public methodRemoveAt Removes the IListT item at the specified index.
Protected methodSetColumnName Changes the name of the column identified by the passed id.
Public methodCode exampleSetColumns Replaces the currently shown columns by the columns passed.
Protected methodSetColumnWidth Sets the width of the column identified by the passed id.
Public methodCode exampleShow Adds the column at its default position.
Top
Events
 NameDescription
Public eventCollectionChanged Occurs when collection has changed.
Top
Example
The following examples control the columns displayed in the ExplorerBrowser.
C#
explorerBrowser1.Columns.Clear();
explorerBrowser1.Columns.Add(SHCOLUMNID.ShellColumnName);
explorerBrowser1.Columns.Add(SHCOLUMNID.ShellColumnSize);
explorerBrowser1.Columns.Add(SHCOLUMNID.ShellColumnParentFolder);
C#
//if you want to define the total set of columns at once, this version is much more performant than adding each column seperately.
explorerBrowser1.Columns.SetColumns(new List<SHCOLUMNID>()
{
    SHCOLUMNID.ShellColumnName,
    SHCOLUMNID.ShellColumnSize,
    SHCOLUMNID.ShellColumnElementType
});
C#
if (IsMyMusic())
{
    //"Show" shows the column at its default position, but you can determine the position by using "Insert" or "Add"
    explorerBrowser1.Columns.Show(SHCOLUMNID.ShellColumnMusicTitlenumber);
    explorerBrowser1.Columns.Show(SHCOLUMNID.ShellColumnSummaryTitle);
    explorerBrowser1.Columns.Show(SHCOLUMNID.ShellColumnMusicArtist);
    explorerBrowser1.Columns.Show(SHCOLUMNID.ShellColumnMusicAlbum);
    explorerBrowser1.Columns.Show(SHCOLUMNID.ShellColumnMusicYear);
    explorerBrowser1.Columns[explorerBrowser1.Columns.Count - 1].Caption = "Custom title";
}
C#
explorerBrowser1.Columns.Remove(SHCOLUMNID.ShellColumnSize); //Removes the Size column. If it doesn't exist it is skipped.
See Also