Click or drag to resize

ShellListViewAddItem Event

This event is fired whenever a new item is added to a ShellListView.

Namespace:  Jam.Shell
Assembly:  ShellBrowser.Winforms (in ShellBrowser.Winforms.dll) Version: 6.3.1
Syntax
public event EventHandler<AddItemEventArgs> AddItem

Value

Type: SystemEventHandlerAddItemEventArgs
Examples
This example will suppress the "My Music" folder and links to be displayed in the ShellListView.
C#
private void ShellListView1_AddItem(object sender, AddItemEventArgs e)
{
    if (e.Item.AbsoluteItemIdList.SpecialFolder == ShellFolder.MyMusic)
        e.CanAdd = false;
    else if (e.Item.AbsoluteItemIdList.HasAttributes(SFGAOF.SFGAO_LINK))
        e.CanAdd = false;
}
Examples
C#
// Use a custom icon for text files.
// Note: Using the ActiveImageList makes sure, the imagelist matching the current view style is addressed.
private void ShellListView1_AddItemCustomIcon(object sender, AddItemEventArgs e)
{
    if (System.IO.Path.GetExtension(e.Item.FullPath).ToUpperInvariant() == ".TXT")
    {
        e.Item.ImageIndex = shellListView1.ActiveImageList.Images.IndexOfKey("document_text.png");
    }
}
See Also