Back to Devexpress

ASPxFileManager.CustomThumbnail Event

aspnet-devexpress-dot-web-dot-aspxfilemanager-1d7f43b4.md

latest3.9 KB
Original Source

ASPxFileManager.CustomThumbnail Event

Occurs each time before a thumbnail or a folder’s icon is created.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event FileManagerThumbnailCreateEventHandler CustomThumbnail
vb
Public Event CustomThumbnail As FileManagerThumbnailCreateEventHandler

Event Data

The CustomThumbnail event's data class is FileManagerThumbnailCreateEventArgs. The following properties provide information specific to this event:

PropertyDescription
FileObsolete. Gets a file related to the event.
IsParentFolderGets a value specifying whether the currently processed item is a parent folder.
ItemGets an item related to the event.
ThumbnailImageGets the settings of a thumbnail image.

Remarks

The CustomThumbnail event enables you to provide a custom thumbnail. Within the event’s handler, the currently processed item can be accessed by using the FileManagerThumbnailCreateEventArgs.Item property. If the parent folder is processed, the FileManagerThumbnailCreateEventArgs.IsParentFolder property returns true. To specify a custom thumbnail for the processed item, use the FileManagerThumbnailCreateEventArgs.ThumbnailImage property.

Concept

Thumbnails

Example

aspx
<dx:ASPxFileManager ID="fileManager" runat="server" OnCustomThumbnail="fileManager_CustomThumbnail">
    ...
</dx:ASPxFileManager>
csharp
public void fileManager_CustomThumbnail(object sender, FileManagerThumbnailCreateEventArgs e) {
    switch(((FileManagerFile)e.Item).Extension) {
        case ".avi":
            e.ThumbnailImage.Url = "Images/movie.png";
            break;
        case ".txt":
            e.ThumbnailImage.Url = "Images/txt.png";
            break;
        case ".mp3":
            e.ThumbnailImage.Url = "Images/music.png";
            break;
        case ".xml":
            e.ThumbnailImage.Url = "Images/code.png";
            break;
    }
}

Online Demo

ASPxFileManager - Custom Thumbnail

See Also

File

ThumbnailFolder

File Manager

ASPxFileManager Class

ASPxFileManager Members

DevExpress.Web Namespace