Databind to tooltip

Is there a way to bind a tooltip to a data source. Here is a simplified example of what I'm trying to do.

I have a DataTable with two columns, one is datetime, the other is varchar. This DataTable is bound to a BindingSource. This binding source has its current record bound to a label displaying the datetime column. How can I get the varchar field associated with this line to appear in the tooltip when I hover over a date stamp.

I understand how tooltips work with static text. It’s just hard for me to figure out how to do this with a dynamic source.

Also, please, your examples in WinForms, almost all the examples that I looked at are based on WPF.

+3
source share
1 answer

I don't really like this answer, so I hope someone can come up with a better one (in my real code, I have about 30 fields that will have a popup), but I could do it

dsMyRows_OnCurrentItemChanged(sender, EventArgs e)
{
    ttPersonWhoDidAction.SetToolTip(lblDate, ((DataRowView)dsMyRows.Current)["TextValue"]);
}
+1
source

Source: https://habr.com/ru/post/1752134/


All Articles