In This Article

ShellTreeListBox Class

Represents a single-column tree view control that enumerates shell objects.

public class ShellTreeListBox : TreeListBox
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl TreeListBox object

Constructors

ShellTreeListBox()

Initializes an instance of the class.

public ShellTreeListBox()

Properties

AssemblyInfo

The UIAssemblyInfoBase to use.

[Browsable(false)]
protected override sealed UIAssemblyInfoBase AssemblyInfo { get; }

Property Value

UIAssemblyInfoBase

CanExpandAll

Indicates whether any expand all operations can occur.

protected override bool CanExpandAll { get; }

Property Value

bool:

true if any expand all operations can occur; otherwise, false. The default value is true.

CanIncludeFiles

Whether files should be displayed.

public bool CanIncludeFiles { get; set; }

Property Value

bool:

true if files should be displayed; otherwise, false. The default value is false.

Whether links should be displayed.

public bool CanIncludeLinks { get; set; }

Property Value

bool:

true if links should be displayed; otherwise, false. The default value is false.

DefaultShellService

The default IShellService that should be used when RootShellFolderParsingName or RootSpecialFolderKind are set.

public IShellService? DefaultShellService { get; set; }

Property Value

IShellService:

The default value is an instance of WindowsShellService.

Remarks

This property is not used if the RootShellFolder property is set directly.

IsDefaultItemContextMenuEnabled

Whether the default context menu is enabled for shell objects.

public bool IsDefaultItemContextMenuEnabled { get; set; }

Property Value

bool:

true if the default context menu is enabled for shell objects; otherwise false. The default value is true.

IsNewFolderContextMenuItemAllowed

Whether a "New / Folder" menu item can be injected into the context menu for file system folders.

public bool IsNewFolderContextMenuItemAllowed { get; set; }

Property Value

bool:

true if a "New / Folder" menu item can be injected into the context menu for file system folders; otherwise, false. The default value is false.

IsRenamingEnabled

Whether objects can be renamed.

public bool IsRenamingEnabled { get; set; }

Property Value

bool:

true if objects can be renamed; otherwise, false. The default value is true.

Remarks

The shell objects themselves must also support renaming via CanRename.

MoveUpCommand

The ICommand used to move the SelectedShellObject up a level.

public ICommand MoveUpCommand { get; }

Property Value

ICommand

RootShellFolder

The root IShellObject to display.

public IShellObject? RootShellFolder { get; set; }

Property Value

IShellObject

RootShellFolderParsingName

The root folder's full parsing name (commonly the same as the file system path), if known.

public string? RootShellFolderParsingName { get; set; }

Property Value

string

Remarks

Setting this property will update the RootShellFolder property.

RootSpecialFolderKind

The SpecialFolderKind that indicates the root special folder to display.

public SpecialFolderKind RootSpecialFolderKind { get; set; }

Property Value

SpecialFolderKind

Remarks

Setting this property will update the RootShellFolder property.

SelectedShellObject

The primary IShellObject that is selected in this control.

public IShellObject? SelectedShellObject { get; set; }

Property Value

IShellObject

Remarks

This property is the same as taking the ShellObjectViewModel value of the SelectedItem property, and getting its Model property.

SelectedShellObjectEditingName

The SelectedShellObject's full user-friendly editing name (commonly the same as the file system path), if known.

public string? SelectedShellObjectEditingName { get; set; }

Property Value

string

Remarks

Setting this property will update the SelectedShellObject property.

Methods

DisposeShellInstances()

Disposes any unmanaged resources held by the RootShellFolder and DefaultShellService instances, and also sets both property values to null.

public void DisposeShellInstances()

Remarks

This method should be called when the control will no longer be used since it ensures any unmanaged resources held by the shell object hierarchy and shell service are disposed.

NotifyDpiChanged()

Notifies that the DPI has changed.

[Obsolete("This method to manually notify of a DPI change was only necessary for .NET Framework targets prior to .NET 4.6.2 and is no longer necessary since DPI changes are now processed automatically.")]
public void NotifyDpiChanged()

Remarks

This method is only included for backwards compatibility and is no longer necessary.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnContextMenuOpening(ContextMenuEventArgs)

Invoked whenever an unhandled ContextMenuOpening routed event reaches this class in its route. Implement this method to add class handling for this event.

protected override void OnContextMenuOpening(ContextMenuEventArgs e)
Parameter Type Description
e ContextMenuEventArgs

The RoutedEventArgs that contains the event data.

OnDpiChanged(DpiScale, DpiScale)

Called when the DPI at which this View is rendered changes.

protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
Parameter Type Description
oldDpi DpiScale

The previous DPI scale setting.

newDpi DpiScale

The new DPI scale setting.

OnIsRootItemVisibleChanged(RoutedEventArgs)

Occurs after the IsRootItemVisible property is changed.

protected override void OnIsRootItemVisibleChanged(RoutedEventArgs e)
Parameter Type Description
e RoutedEventArgs

The event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnItemMenuRequested(TreeListBoxItemMenuEventArgs)

Occurs when an item requests a context menu.

protected override void OnItemMenuRequested(TreeListBoxItemMenuEventArgs e)
Parameter Type Description
e TreeListBoxItemMenuEventArgs

The event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

OnSelectionChanged(SelectionChangedEventArgs)

Occurs when the selection is changed.

protected override void OnSelectionChanged(SelectionChangedEventArgs e)
Parameter Type Description
e SelectionChangedEventArgs

The event data.

Remarks

This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

SelectItemByFullPath(string)

Sets the SelectedItem to the node with the specified full path.

public override bool SelectItemByFullPath(string fullPath)
Parameter Type Description
fullPath string

The full path to the node whose container should be selected.

Returns

bool:

true if a node was selected; otherwise, false.

Remarks

This method requires that the ItemAdapter supplies a path for each item.

Fields

CanIncludeFilesProperty

Defines the CanIncludeFiles property.

public static readonly DependencyProperty CanIncludeFilesProperty

CanIncludeLinksProperty

Defines the CanIncludeLinks property.

public static readonly DependencyProperty CanIncludeLinksProperty

DefaultShellServiceProperty

Defines the DefaultShellService property.

public static readonly DependencyProperty DefaultShellServiceProperty

IsDefaultItemContextMenuEnabledProperty

Defines the IsDefaultItemContextMenuEnabled property.

public static readonly DependencyProperty IsDefaultItemContextMenuEnabledProperty

IsNewFolderContextMenuItemAllowedProperty

Defines the IsNewFolderContextMenuItemAllowed property.

public static readonly DependencyProperty IsNewFolderContextMenuItemAllowedProperty

IsRenamingEnabledProperty

Defines the IsRenamingEnabled property.

public static readonly DependencyProperty IsRenamingEnabledProperty

RootShellFolderParsingNameProperty

Defines the RootShellFolderParsingName property.

public static readonly DependencyProperty RootShellFolderParsingNameProperty

RootShellFolderProperty

Defines the RootShellFolder property.

public static readonly DependencyProperty RootShellFolderProperty

RootSpecialFolderKindProperty

Defines the RootSpecialFolderKind property.

public static readonly DependencyProperty RootSpecialFolderKindProperty

SelectedShellObjectEditingNameProperty

Defines the SelectedShellObjectEditingName property.

public static readonly DependencyProperty SelectedShellObjectEditingNameProperty

SelectedShellObjectProperty

Defines the SelectedShellObject property.

public static readonly DependencyProperty SelectedShellObjectProperty

Inherited Members

Extension Methods