I have several appointments added to an UltraMonthViewSingle. When the mouse hovers over it a default tooltip is displayed showing the start and end time along with the subject.
I wish to hook in to this system and modify what is displayed, or suppres the default information and duisplay my own.
The control does not fire an event before displaying the tooltip. You could, however, use the TipStyleActivity property to prevent tooltips from displaying altogether, then use an UltraToolTipManager component or the standard .NET ToolTip component to display a custom tooltip.
That is dissapointing.
I was hoping that I could use the ToolTipItem on the UIElement like you can for Tree Controls to display special tool tips
It seems that that the SingleDayAppointmentUIElement does not use the Tooltip info but if I turn of tool tips like you mentioned I can hook up to the ToolTipItem interface EditorWithTextDisplayTextUIElement and work my way up the parent chain to the appointment.
This can be achieved by …
1) Add a UltraToolTipManager to the form where the UltraMonthViewSingle exists
2) Set the TipStyleActivity on the UltraMonthViewSingle to None
3) Handle the MouseEnterElement event of the UltraMonthViewSingle
4) Check for SingleDayAppointmentUIElement Element
5) Return the Appointment Object via the GetAppointmentFromPoint method
6) Return the custom object which the appointment was bound to (if required)
7) Create UltraToolTipInfo with the information you wish to display
8) Show the ToolTip in the control
Example Code:
private void CMSMonthViewSingle_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)
{
// check for the correct element type
if (e.Element is Infragistics.Win.UltraWinSchedule.MonthViewSingle.SingleDayAppointmentUIElement)
// return the current appointment from the x/y position of the mouse
Appointment MouseEnterAppointment = this.GetAppointmentFromPoint(new Point(e.Element.Rect.X, e.Element.Rect.Y));
// check that the appointment can be retrieved from the position
if (MouseEnterAppointment != null)
// return the dynamic appointment from the bound appointment object
CMSDynamicAppointmentDetail DynamicAppointment = (CMSDynamicAppointmentDetail )MouseEnterAppointment.BindingListObject;
UltraToolTipInfo ToolTipInfo = new UltraToolTipInfo(string.Empty, ToolTipImage.Info, "Appointment Information", DefaultableBoolean.True);
ToolTipInfo.ToolTipTextStyle = ToolTipTextStyle.Raw;
ToolTipInfo.Appearance.FontData.Name = "Lucida Console";
ToolTipInfo.Appearance.FontData.SizeInPoints = 7;
ToolTipInfo.ToolTipText = DynamicAppointment.ToolTip;
// Show tool-tip
this.UltraToolTipManager1.SetUltraToolTip(this.UltraMonthViewSingle1, ToolTipInfo);
this.UltraToolTipManager1.ShowToolTip(this.UltraMonthViewSingle1);
}
What is the CMSDynamicAppointmentDetail ? I am using vb.net 2008. Is this part of infragistics?
Thanks
That line refers to no.6 - returning a custom object, but you don't need to do that for the example, unless your custom object contains the tool tip information that you'd like to display.
The code that I've posted here is actual production code and the CMSDynamicAppointmentDetail object is a class that I've created to facilitate some functionality within our system. A collection of these must have been bound to month view object by implementing the IBindable interface. The .BindingListObject statement therefore returns the original object which the individual appointment refers to.