Skip to content

DevExpress-Examples/winforms-grid-tileview-thumbnails-async-load

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Data Grid - Create thumbnails and load them asynchronously in a TileView

This example shows how to generate background images (thumbnails) for tiles in a TileView and load them asynchronously.

WinForms Data Grid - Create thumbnails and load them asynchronously in a TileView

In this example:

The TileView is bound to a list that contains texture names. We created custom background thumbnails for all tiles based on corresponding texture names, and display these images asynchronously. The AsyncLoad setting enables async tile loading.

private void Form1_Load(object sender, EventArgs e) {
    InitData();
    gridControl1.DataSource = textures;
    tileView1.OptionsTiles.ItemSize = new Size(90, 40);
    tileView1.GetThumbnailImage += TileView1_GetThumbnailImage;
    // Specifies a column that contains information on tile images.
    tileView1.ColumnSet.BackgroundImageColumn = colName;
    tileView1.OptionsImageLoad.RandomShow = true;
    tileView1.OptionsImageLoad.LoadThumbnailImagesFromDataSource = false;
    // Enables async image load.
    tileView1.OptionsImageLoad.AsyncLoad = true;
}

Thumbnails are generated within the GetThumbnailImage event.

private void TileView1_GetThumbnailImage(object sender, DevExpress.Utils.ThumbnailImageEventArgs e) {
    string colorName = textures[e.DataSourceIndex].Name;
    e.ThumbnailImage = GetImage(e.DesiredThumbnailSize, colorName);
}

Files to Review