Skip to main content

Tutorial: Tile View - Service Columns and Dynamic Tile Customization

  • 3 minutes to read

This walkthrough is a transcript of the Tile View - Service Columns and Dynamic Tile Customization video available on the DevExpress YouTube Channel.

In this tutorial, you will learn how to apply data grouping to the Tile View, how to control the enabled state or check status of tiles depending on a field value and how to customize tile items using a specially designed event.

Applying Data Grouping

Expand the TileView.ColumnSet property to explore the list of service columns the Tile View can use. These columns affect the View without displaying their data in the corresponding tile items. They set background images, the tile checked state, enabled state and, finally, group the View against the specified data field. Start with grouping the View against the Country column.

TileView_SpecifyingGroupColumn

Once you have set the column, expand the TileView.Appearance property and change the GroupText style.

TileView_ChangingGroupTextStyle

Run the application to see that all tiles are now divided into two groups – UK and USA.

TileView_GroupingResult

Return to design time and select the Country column in the Property Grid. Set the OptionsColumn.ShowCaption option to true and run the application again. Group captions will now contain field name prefixes.

TileView_GroupingColumnsWithCaptions

Changing the Enabled State for Specific Tiles

Expand the TileView.ColumnSet property again and now set the EnabledColumn property. The bound data field values will specify the enabled state for individual tiles.

TileView_EnabledColumnProperty

Run the application to see how disabled tiles look and make sure that they don’t respond to user actions in the same way enabled tiles do.

TileView_DisabledTilesResult

Dynamic Tile Customization

Now see how you can enable conditional formatting in the Tile View. You will hide a tile item in certain tiles depending on their data.

Add a new static text element and set its caption to On Vacation. Align the item to the bottom of the Tile template and set the TileItemElement.StretchHorizontal propery to true and TileItemElement.Height to 20. Change the element’s background and foreground colors to add contrast.

TileView_StaticItemForCFProperties

You need to display this newly added element only for disabled tiles. To do so, handle the View’s TileView.ItemCustomize event. If the Available value in the current row is true, hide the element from the tile by setting text to an empty string and background color to transparent.

private void tileView1_ItemCustomize(object sender, DevExpress.XtraGrid.Views.Tile.TileViewItemCustomizeEventArgs e) {
    TileView view = sender as TileView;
    if ((bool)view.GetRowCellValue(e.RowHandle, colAvailable) == true) {
        e.Item.Elements[9].Text = "";
        e.Item.Elements[9].Appearance.Normal.BackColor = Color.Transparent;
    }
}

Run the application to see the result. The label is only displayed in disabled items as planned.

TileView_TilesWithDinamicItem

See Also
Tutorial: Tile View - Service Columns and Dynamic Tile Customization