Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Display Custom Images in Card Captions

In the following code snippet from the GridMainDemo, the CardView.CustomCardCaptionImage event is handled to display custom images in card captions. First, an underlying data object (VehiclesData.Model) corresponding to the currently processed card is obtained using the ColumnView.GetRow method. The image to display in the card caption is retrieved from this object and assigned to the event’s Image parameter. Please refer to the GridMainDemo for a complete example.

CardView_CustomCardCaptionImage

private void cardView1_CustomCardCaptionImage(object sender, DevExpress.XtraGrid.Views.Card.CardCaptionImageEventArgs e) {
    VehiclesData.Model model = cardView1.GetRow(e.RowHandle) as VehiclesData.Model;

    e.Image = model.GetSmallTrademarkImage();
}