In This Article

ShellObjectItemAdapter Class

Provides an abstract base class for a TreeListBoxItemAdapter that can be used in a ShellTreeListBox or ShellListView.

public class ShellObjectItemAdapter : TreeListBoxItemAdapter
Inheritance:
object TreeListBoxItemAdapter object

Constructors

ShellObjectItemAdapter()

Initializes a new instance of the ShellObjectItemAdapter class.

public ShellObjectItemAdapter()

Methods

CanHaveChildren(TreeListBox, object)

Returns whether the specified item is capable of having child items.

public override bool CanHaveChildren(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

bool:

true if the specified item is capable of having child items; otherwise, false.

Remarks

The default implementation of this method returns true. This method should only return false if an item is not capable of having child items and is always a 'leaf' node in the tree. It should not return false if the item can have child items, but doesn't at the current time.

Optimizations are in place to not call GetChildren(TreeListBox, object) when this method returns true. This method should be overridden if OnExpansion is used and certain items are known to be 'leaf' nodes.

CreateShellObjectViewModel(TreeListBox, IShellObject)

Creates a new ShellObjectViewModel that wraps the specified IShellObject.

protected virtual ShellObjectViewModel CreateShellObjectViewModel(TreeListBox ownerControl, IShellObject shellObject)
Parameter Type Description
ownerControl TreeListBox

The owner control.

shellObject IShellObject

The IShellObject to wrap.

Returns

ShellObjectViewModel:

The ShellObjectViewModel that was created.

Remarks

Override this method to customize the IShellObject before it is added to the user interface. Return null to prevent the IShellObject from being added.

GetAbsolutePath(TreeListBox, object)

Returns the item's absolute (rooted) string path, if known from the item itself.

public override string GetAbsolutePath(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

string:

The item's absolute (rooted) string path, if known.

Remarks

The absolute path can be used to improve performance when searching for an item in a large tree since it allows for a path-based search instead of an exhaustive breadth-first search through the tree. A null string should be returned for items that don't know their absolute path.

GetBackgroundContextMenu(TreeListBox, ShellObjectViewModel)

Returns the ContextMenu for the background of a control with the specified root view-model.

public virtual ContextMenu GetBackgroundContextMenu(TreeListBox ownerControl, ShellObjectViewModel rootViewModel)
Parameter Type Description
ownerControl TreeListBox

The owner control.

rootViewModel ShellObjectViewModel

The root view-model.

Returns

ContextMenu:

The ContextMenu for the background of a control with the specified root view-model.

GetChildren(TreeListBox, object)

Returns an IEnumerable that will be used to provide child items for the specified parent item.

public override IEnumerable GetChildren(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

IEnumerable:

An IEnumerable that will be used to provide child items for the specified parent item.

GetIsEditable(TreeListBox, object)

Returns whether the specified item is editable.

public override bool GetIsEditable(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

bool:

true if the specified item is editable; otherwise, false.

GetIsEditing(TreeListBox, object)

Returns whether the specified item is currently being edited.

public override bool GetIsEditing(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

bool:

true if the specified item is currently being edited; otherwise, false.

GetIsExpanded(TreeListBox, object)

Returns whether the specified item is expanded.

public override bool GetIsExpanded(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

bool:

true if the specified item is expanded; otherwise, false.

GetIsSelected(TreeListBox, object)

Returns whether the specified item is selected.

public override bool GetIsSelected(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

bool:

true if the specified item is selected; otherwise, false.

GetItemContextMenu(TreeListBox, IList<ShellObjectViewModel>)

Returns the ContextMenu for the specified collection of view-models.

public virtual ContextMenu GetItemContextMenu(TreeListBox ownerControl, IList<ShellObjectViewModel> viewModels)
Parameter Type Description
ownerControl TreeListBox

The owner control.

viewModels IList<ShellObjectViewModel>

The view-models to examine.

Returns

ContextMenu:

The ContextMenu for the specified collection of view-models.

GetPath(TreeListBox, object)

Returns the item's string path, relative to its parent.

public override string GetPath(TreeListBox ownerControl, object item)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to examine.

Returns

string:

The item's string path, relative to its parent.

SetIsEditing(TreeListBox, object, bool)

Sets whether the specified item is currently being edited.

public override void SetIsEditing(TreeListBox ownerControl, object item, bool value)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to update.

value bool

The new value.

SetIsExpanded(TreeListBox, object, bool)

Sets whether the specified item is expanded.

public override void SetIsExpanded(TreeListBox ownerControl, object item, bool value)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to update.

value bool

The new value.

SetIsSelected(TreeListBox, object, bool)

Sets whether the specified item is selected.

public override void SetIsSelected(TreeListBox ownerControl, object item, bool value)
Parameter Type Description
ownerControl TreeListBox

The owner control.

item object

The item to update.

value bool

The new value.

Inherited Members