Hi,
I have a model with data annotations, for example:
[DataMember()]
[Display(Name = "Projekt neve", Description = "Tooltip", Order = 2)]
[Required(ErrorMessage = "A mező kitöltése kötelező!")]
[StringLength(60, ErrorMessage = "Maximum {1} karakter hosszú lehet!")]
public string? Megnevezes { get; set; }
With these settings the grid sets the column name and order well, but it not show the Description part as the column header tooltip.
Can you help me please how can I solve this problem?
Thank you!
BR, SZL
Hi SZL,
SfDataGrid Does not contain direct support to set the column header tooltip with DataAnnotation. Currently, we are checking the feasibilities to achieve your requirement. We need two more business days to validate this. We will update you with further details on August 23, 2022.
We appreciate your patience until then.
Regards,
Dhanasekar M.
Hi SZL,
Still, we are checking the feasibilities to achieve your requirement. We will check and update you with further details on August 25, 2022.
We appreciate your patience and understanding.
Regards,
Dhanasekar M.
Hi SZL,
You can achieve your requirement to Set the Description attribute content to the tooltip message using the tooltip opening event shown below,
|
private void SfDataGrid1_ToolTipOpening(object sender, Syncfusion.WinForms.DataGrid.Events.ToolTipOpeningEventArgs e) { var record = (this.sfDataGrid1.View.Records[0].Data as OrderInfo).GetType().GetProperty(e.Column.MappingName); var propertyInfo = record.GetCustomAttributes(true); if (e.RowIndex == 0) { if (propertyInfo == null || propertyInfo.Length == 0 || (propertyInfo[0] as DisplayAttribute).Description == null) return;
e.ToolTipInfo.Items[0].Text = (record.GetCustomAttributes(true)[0] as DisplayAttribute).Description; } } |
Here we have prepared a sample based on your requirement. Please find the sample in the attachment and let us know if you have any concerns about this.
Regards,
Dhanasekar M.
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
Hy,
Thank you for help! Based on your example I succeed to show the tooltip.
BR, SZL
Hi SZL,
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you.
Regards,
Dhanasekar M.