How to customize schedule appointment tip
Hi ,
I want to customize the Schedule appointment tip. How can I remove the location and time from it?
Eric Huang
Hi Eric Huang,
Thank you for reaching out.
Query:
I want to customize the Schedule appointment tip. How can I remove the location and time from it?
Solution 1:
As per your requirement to only display the appointment heading,
you can disable the AdvancedToolTip control by setting the EnableAdvancedToolTip
API to false. Additionally, enable the ScheduleAppointmentToolTip control by
setting ScheduleAppointmentTipsEnabled API to true. This will ensure that only
the appointment heading is shown.
Code Snippet:
|
public Form1() { InitializeComponent(); tooltipTimer=new System.Windows.Forms.Timer(); tooltipTimer.Interval=500; tooltipTimer.Tick += TooltipTimer_Tick; scheduleControl1.Appearance.EnableAdvancedToolTip = false; scheduleControl1.Appearance.ScheduleAppointmentTipsEnabled = true; CustomFilterComboBox.DataSource = new ObservableCollection<string>() { "DataSource1", "DataSource2", "DataSource3" }; CustomFilterComboBox.SelectedValueChanged += CustomFilterComboBox_SelectedValueChanged; this.Load += Form1_Load; } |
Solution 2:
If you wish to remove the location and time from the AdvancedToolTip
while keeping the appointment heading, this can be done by customizing the
tooltip control. It can be achieved by handle the ShowingAdvancedToolTip event,
where you can update the tooltip text as per your needs and display the
modified tooltip control.
Code Snippet:
|
private void Form1_ShowingAdvancedToolTip(object sender, ScheduleGrid.ShowingAdvancedTooltipEventArgs e) { e.Cancel = true;
var position = (sender as ScheduleGrid).LastMousePosition; var scheduleItem = e.Appointment; StringBuilder tooltipContent = new StringBuilder(); tooltipContent.AppendLine( scheduleItem.Subject.ToString()); tooltipContent.AppendLine($"Raminader : {scheduleItem.ReminderText}"); currentTooltipText = tooltipContent.ToString(); currentTooltipLocation = position; tooltipTimer.Stop(); tooltipTimer.Start(); } { tooltipTimer.Stop(); int tooltipWidth = 270; //int tooltipHeight = Math.Min(180, 30 * currentTooltipText.Split('\n').Length); int tooltipHeight = 270; int adjustedX = currentTooltipLocation.X + tooltipWidth > this.ClientSize.Width ? this.ClientSize.Width - tooltipWidth : currentTooltipLocation.X; int adjustedY = currentTooltipLocation.Y + tooltipHeight > this.ClientSize.Height ? this.ClientSize.Height - tooltipHeight : currentTooltipLocation.Y;
toolTip.Show(currentTooltipText, this, adjustedX, adjustedY, 5000); }
|
Regards,
Santhosh.G
Attachment: WinForms_ScheduleControl_NetCore_fbe4c7c9.zip
Dear Santhosh,
Thanks, I can change the tooltip text by this code now.
Eric H.
Hi Eric,
You're welcome. Please get back to us if you need any further assistance or if
you encounter any new issue, please create a new ticket for further follow up.
We will be happy to help you.
Regards,
Gokul S
- 3 Replies
- 3 Participants
-
EH Eric Huang
- Oct 24, 2024 04:57 PM UTC
- Oct 31, 2024 04:53 AM UTC