Click or drag to resize

IJamShellColumnCollection Interface

Interface representing a ColumnCollection. This interface is returned by Columns

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 6.2
Syntax
public interface IJamShellColumnCollection : ICollection, 
	IEnumerable

The IJamShellColumnCollection type exposes the following members.

Properties
Methods
  NameDescription
Public methodAdd(ColumnHeader) Obsolete.
Adds the specified ColumnHeader to the collection. Please use Add(JamShellColumnHeader) instead.
Public methodCode exampleAdd(JamShellColumnHeader)
Adds the specified JamShellColumnHeader to the collection.
Public methodCode exampleAdd(SHCOLUMNID)
Adds the shell column identified by the passed SHCOLUMNID.
Public methodCode exampleClear
Clears this instance.
Public methodCode exampleGetColumnByShellIndex
Gets the JamShellColumnHeader identified by the passed shell index.
Public methodInsert
Inserts the shell column identified by the passed SHCOLUMNID at the passed position.
Public methodRemove(JamShellColumnHeader)
Removes the specified ColumnHeader from the collection.
Public methodRemove(SHCOLUMNID)
Removes the shell column identified by the passed SHCOLUMNID.
Public methodCode exampleShow
Shows the shell column identified by the passed SHCOLUMNID at its default shell position.
Top
Examples
This example re-initializes the columns displayed for MyMusic in the CreatedColumns event.
C#
private void ShellListView1_CreatedColumns(object sender, EventArgs e)
{
    if (shellListView1.SpecialFolder == ShellFolder.MyMusic)
    {
        shellListView1.BeginUpdate();
        shellListView1.Columns.Clear(); //name column it will be reinserted again automatically.
        shellListView1.Columns.Show(SHCOLUMNID.ShellColumnSummaryTitle);
        //displays the column at the default position.
        shellListView1.Columns.Show(SHCOLUMNID.ShellColumnMusicAlbum);
        shellListView1.Columns.Show(SHCOLUMNID.ShellColumnMusicArtist);
        shellListView1.Columns.Add(SHCOLUMNID.ShellColumnMusicGenre); //adds the column at the end.

        shellListView1.EndUpdate();
    }
}
Examples
This example adds custom columns in the CreatedColumns event.
C#
private void ShellListView_CreatedColumns(object sender, EventArgs e)
{
    // add a column for the path length
    JamShellColumnHeader lCol = new JamShellColumnHeader();
    lCol.Text = cPathLengthString;
    lCol.TextAlign = HorizontalAlignment.Right;
    lCol.Width = 85;
    shellListView1.Columns.Add(lCol);
    lCol.DisplayIndex = 1; //if you want a different position for your column use the DisplayIndex.



    // add a column for the link target
    lCol = new JamShellColumnHeader();
    lCol.Text = cLinkTargetString;
    // the link target is a full path so we need a large column
    lCol.Width = 350;
    shellListView1.Columns.Add(lCol);
}

private void ShellListView_AddItem(object sender, Jam.Shell.AddItemEventArgs e)
{
    //The AddItem is called for every item that is added to the list. You need to provide values for the custom columns.
    //Add the subitems in the same order the columns were added (the index of column and subItems must match).

    // get the path length
    string lLength = e.Item.FullPath.Length.ToString(System.Globalization.CultureInfo.CurrentCulture);
    // add the path length as subitem
    e.Item.SubItems.Add(lLength);

    // check whether the item is a link
    // note: the next few lines are just used for illustrative purposes.
    // the retrieval of the link target may take some time for large file lists
    string lLinkTarget = ShellBrowser.GetLinkTarget(e.Item.FullPath);
    // add the link target as subitem (if it`s not a link, an empty string was returned)
    e.Item.SubItems.Add(lLinkTarget);
}
See Also