Hi Justin,
The CardView.CardCaptionFormat property used to format show caption passed the card rowHandle agument. You cannot use it to show card values. To show a custom card caption you should handle the CardView.CustomDrawCardCaption event and explicitly set the CardInfo.CaptionInfo.CardCaption property. I have prepared an example for you. It is in the attachment. The essential code follows:
Private Sub CardView1_CustomDrawCardCaption(ByVal sender As System.Object, ByVal e As DevExpress.XtraGrid.Views.Card.CardCaptionCustomDrawEventArgs) Handles CardView1.CustomDrawCardCaption
Dim view As DevExpress.XtraGrid.Views.Card.CardView = sender
Dim s As String = String.Format("Subject: {0}", view.GetRowCellDisplayText(e.RowHandle, "ProductName"))
CType(e.CardInfo, DevExpress.XtraGrid.Views.Card.ViewInfo.CardInfo).CaptionInfo.CardCaption = s
End Sub
I'm looking forward to hearing from you.
Thanks,
Michael.
Thanks Michael for your repsonse, the code worked. However the help file and the GridMainDemo indicates that you can do this with the CardCaptionFormat. The help file at:
ms-help://DevExpress.NET.2005v6.2/DevExpress.XtraGrid/DevExpressXtraGridViewsCardCardViewCardCaptionFormattopic.htm
states that:
The CardCaptionFormat property enables you to construct a caption text using static text together with the current record number and column values. The '{0}' character sequence is a placeholder for the current record number. Thus, the default property value specifies that card captions should contain 'Record N ' followed by the card number. To display column values within card captions, you need to use the desired column indexes. For instance, a '{1}' character sequence is a placeholder for the first column value, etc.
It was this suggestion that I was following, but couldn't work out what the requied column index is. Have I mis-understood what the CardCaptionFormat is meant to be used for?
Thanks
Justin
Hi Justin,
Sorry for misleading you a little. The CardView.CardCaptionFormat property can be used to show column values as well. The argument index passed is the column AbsoluteIndex+1. Thus, in your instance you should use the following code:
Grid.vwCardView.CardCaptionFormat = "Subject: {" & (Grid.vwCardView.Columns("TASK_SUBJECT").AbsoluteIndex + 1) & "}"
Thanks,
Michael.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.