In This Article

ShellListView Class

Represents a list view control that enumerates shell objects.

public class ShellListView : TreeListView
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl TreeListBox TreeListView object

Constructors

ShellListView()

Initializes an instance of the class.

public ShellListView()

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 true.

CanIncludeFolders

Whether folders should be displayed.

public bool CanIncludeFolders { get; set; }

Property Value

bool:

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

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 true.

CanNavigateIntoChildFolders

Whether the default action for folders should be to navigate into the child folder.

public bool CanNavigateIntoChildFolders { get; set; }

Property Value

bool:

true if the default action for folders should be to navigate into the child folder; otherwise, false. The default value is true.

CanResetSortOnRootShellFolderChange

Whether the list's sort should be reset when changing the RootShellFolder.

public bool CanResetSortOnRootShellFolderChange { get; set; }

Property Value

bool:

true if the list's sort should be reset when changing the RootShellFolder; otherwise, false. The default value is true.

CanUseThumbnails

Whether thumbnail images can be used in place of icons when available.

public bool CanUseThumbnails { get; set; }

Property Value

bool:

true if thumbnail images can be used in place of icons when available; otherwise, false. The default value is true.

Remarks

Thumbnails are only used in certain LayoutMode options that render larger images.

ColumnHeaderTemplate

The DataTemplate to use for rendering column headers.

public DataTemplate? ColumnHeaderTemplate { get; set; }

Property Value

DataTemplate

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.

DetailsLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is Details.

public DataTemplate? DetailsLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

ExtraLargeIconsLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is ExtraLargeIcons.

public DataTemplate? ExtraLargeIconsLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

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.

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.

LargeIconsLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is LargeIcons.

public DataTemplate? LargeIconsLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

LayoutMode

A ShellListViewLayoutMode value indicating the item layout mode.

public ShellListViewLayoutMode LayoutMode { get; set; }

Property Value

ShellListViewLayoutMode:

A ShellListViewLayoutMode value indicating the item layout mode. The default value is Details.

ListLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is List.

public DataTemplate? ListLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

MediumIconsLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is MediumIcons.

public DataTemplate? MediumIconsLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

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.

SmallIconsLayoutModeItemTemplate

The DataTemplate to use as the ItemTemplate when the LayoutMode is SmallIcons.

public DataTemplate? SmallIconsLayoutModeItemTemplate { get; set; }

Property Value

DataTemplate

SortDirection

The ColumnSortDirection that indicates the current sort direction.

public ColumnSortDirection SortDirection { get; set; }

Property Value

ColumnSortDirection:

The default value is Ascending.

See Also

SortShellPropertyKey

The Key of the IShellProperty whose column should be sorted.

public object? SortShellPropertyKey { get; set; }

Property Value

object

See Also

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.

GetContainerForItemOverride()

Creates or identifies the element that is used to display the given item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

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()

OnColumnHeaderTapped(TreeListViewColumnEventArgs)

Occurs when a column's header is tapped.

protected override void OnColumnHeaderTapped(TreeListViewColumnEventArgs e)
Parameter Type Description
e TreeListViewColumnEventArgs

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.

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.

OnItemDefaultActionExecuting(TreeListBoxItemEventArgs)

Occurs before the default action is executed for an item.

protected override void OnItemDefaultActionExecuting(TreeListBoxItemEventArgs e)
Parameter Type Description
e TreeListBoxItemEventArgs

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.

ProcessKeyDown(KeyEventArgs)

Processes a key down event.

protected override void ProcessKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The event data.

RefreshColumns()

Refreshes the list's columns by requerying the CreateProperties(IList<IShellObject>, ShellPropertyRequestKind) method for properties.

public void RefreshColumns()

Fields

CanIncludeFilesProperty

Defines the CanIncludeFiles property.

public static readonly DependencyProperty CanIncludeFilesProperty

CanIncludeFoldersProperty

Defines the CanIncludeFolders property.

public static readonly DependencyProperty CanIncludeFoldersProperty

CanIncludeLinksProperty

Defines the CanIncludeLinks property.

public static readonly DependencyProperty CanIncludeLinksProperty

CanNavigateIntoChildFoldersProperty

Defines the CanNavigateIntoChildFolders property.

public static readonly DependencyProperty CanNavigateIntoChildFoldersProperty

CanResetSortOnRootShellFolderChangeProperty

public static readonly DependencyProperty CanResetSortOnRootShellFolderChangeProperty

CanUseThumbnailsProperty

Defines the CanUseThumbnails property.

public static readonly DependencyProperty CanUseThumbnailsProperty

ColumnHeaderTemplateProperty

Defines the ColumnHeaderTemplate property.

public static readonly DependencyProperty ColumnHeaderTemplateProperty

DefaultShellServiceProperty

Defines the DefaultShellService property.

public static readonly DependencyProperty DefaultShellServiceProperty

DetailsLayoutModeItemTemplateProperty

Defines the DetailsLayoutModeItemTemplate property.

public static readonly DependencyProperty DetailsLayoutModeItemTemplateProperty

ExtraLargeIconsLayoutModeItemTemplateProperty

public static readonly DependencyProperty ExtraLargeIconsLayoutModeItemTemplateProperty

IsDefaultItemContextMenuEnabledProperty

Defines the IsDefaultItemContextMenuEnabled property.

public static readonly DependencyProperty IsDefaultItemContextMenuEnabledProperty

IsRenamingEnabledProperty

Defines the IsRenamingEnabled property.

public static readonly DependencyProperty IsRenamingEnabledProperty

LargeIconsLayoutModeItemTemplateProperty

Defines the LargeIconsLayoutModeItemTemplate property.

public static readonly DependencyProperty LargeIconsLayoutModeItemTemplateProperty

LayoutModeProperty

Defines the LayoutMode property.

public static readonly DependencyProperty LayoutModeProperty

ListLayoutModeItemTemplateProperty

Defines the ListLayoutModeItemTemplate property.

public static readonly DependencyProperty ListLayoutModeItemTemplateProperty

MediumIconsLayoutModeItemTemplateProperty

Defines the MediumIconsLayoutModeItemTemplate property.

public static readonly DependencyProperty MediumIconsLayoutModeItemTemplateProperty

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

SmallIconsLayoutModeItemTemplateProperty

Defines the SmallIconsLayoutModeItemTemplate property.

public static readonly DependencyProperty SmallIconsLayoutModeItemTemplateProperty

SortDirectionProperty

Defines the SortDirection property.

public static readonly DependencyProperty SortDirectionProperty

SortShellPropertyKeyProperty

Defines the SortShellPropertyKey property.

public static readonly DependencyProperty SortShellPropertyKeyProperty

Inherited Members

Extension Methods