atfat
asked on 22 May 2021, 10:59 AM
| edited on 22 May 2021, 11:01 AM
Hi, can I use callout control to display additional information, from a datagridview cell instead of a tooltip ?
if yes can u leave a sample please...
thx in advance,
Regards
1 Answer, 1 is accepted
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 May 2021, 01:02 PM
Hello, Atfat,
You can handle the RadGridView.ToolTipTextNeeded event and instead of specifying the text for the tooltip, you can show programmatically a RadCallout. I have prepared a sample code snippet for your reference:
publicRadForm1()
{
InitializeComponent();
this.radGridView1.Columns.Add("Id");
this.radGridView1.Columns.Add("Name");
for (int i = 0; i < 10; i++)
{
this.radGridView1.Rows.Add(i, Guid.NewGuid().ToString());
}
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
label = new RadLabel();
label.Text = "Telerik";
callout = new RadCallout();
callout.AssociatedControl = label;
this.radGridView1.ToolTipTextNeeded+=radGridView1_ToolTipTextNeeded;
}
privatevoidradGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
{
Point pt = this.radGridView1.PointToClient(MousePosition);
GridDataCellElement cellUnderMouse = this.radGridView1.ElementTree.GetElementAtPoint(pt) as GridDataCellElement;
if (cellUnderMouse != null)
{
label.Text = cellUnderMouse.Value + "";
if (callout.CalloutForm.Visible)
{
callout.Close();
}
callout.Show(cellUnderMouse);
}
}
RadCallout callout;
RadLabel label;
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.