This is a migrated thread and some comments may be shown as answers.

Interactive ToolTip

5 Answers 169 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 21 May 2014, 01:06 PM
Hi,

In my application, I implemented and Interactive ToolTip which consist to have a tooltip always open with a usercontrol inside of it which contain buttons. When the user click on the buttons, action is taken and the popup is close.

I use it like this :

                    <Button Margin="20" Content="ToolTip" Width="80" HorizontalAlignment="Left">
                        <i:Interaction.Behaviors>
                            <ctrlToolTip:ToolTipCustomBehavior>
                                <local:UCToolTip />
                            </ctrlToolTip:ToolTipCustomBehavior>
                        </i:Interaction.Behaviors>
                    </Button>

What I would like to do is to use my interactive tooltip with each appointments. I mean I would like to do something like the custom tooltip demo for the ScheduleView but with my interactive tooltip, how I can do it?

Thank's
Alain

5 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 23 May 2014, 11:18 AM
Hi Alain,

I assume your interactive ToolTip is actually a Popup? So you would need to define the that Popup as Resource so you can find in the code behind. Afterwards you will need a class handler for the MouseEnter event of the AppointmentItems - this way you will be able to open the Popup once the mouse is over each Appointment as for the closing of the Popup depending on the custom logic you can close it when needed by setting its IsOpen property to false. Please check the following code snippet:

private Popup popup;
public MainWindow()
{
    InitializeComponent();
 
    this.popup = this.Resources["samplePopup"] as Popup;
    EventManager.RegisterClassHandler(typeof(AppointmentItem), UIElement.MouseEnterEvent, new MouseEventHandler(OnMouseEnterHandler), true);
}
 
private void OnMouseEnterHandler(object sender, MouseEventArgs e)
{
    popup.PlacementTarget = sender as AppointmentItem;
 
    if (popup.IsOpen)
    {
        popup.IsOpen = false;
    }
 
    popup.IsOpen = true;
}

Also in order to avoid the showing of the default ToolTip you will have to set the ToolTipTemplate property of the ScheduleView to {x:Null}.

Hope this will work for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Christie Admin
Top achievements
Rank 1
answered on 23 May 2014, 07:08 PM
Hi Kalin,

great :)

It's not a popup but a usercontrol and I put it in a popup internally.

one question, in my application I have 3 UserControls containing a ScheduleView, so I want to register the event only for one of my usercontrol. Actually when the EventManager.RegisterClassHandler is called, the event is associated to all of my usercontrols :(

Does the AppointmentItem class provide such a method to unregister the class??

Thank's
Alain
0
Kalin
Telerik team
answered on 27 May 2014, 08:41 AM
Hi Alain,

The RegisterClassHandler method subscribes to desired event of every instance of the targeted class - that is why it is applied to all of Appointments in all of the ScheduleViews. What I can suggest you is to check in the handler whether the AppointmentItem is in the correct ScheduleView and if so - to execute the custom logic:

private void OnMouseEnterHandler(object sender, MouseEventArgs e)
{
    var scheduleView = (sender as AppointmentItem).ParentOfType<RadScheduleView>();
 
    if (scheduleView.Name == "scheduleView")
    {
        // it is the correct ScheduleView do the custom logic here
    }
}

Hope this will help you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Christie Admin
Top achievements
Rank 1
answered on 16 Jun 2014, 04:47 PM
Hi Kalin,

I would like to know if it's possible to have such kind of event for the special slots?

Thank's
Alain
0
Kalin
Telerik team
answered on 18 Jun 2014, 03:08 PM
Hello Alain,

What I can suggest you would be to check the following example from our online SDK repository which demonstrates how to implement a ToolTip on the SpecialSlots:
https://github.com/telerik/xaml-sdk/tree/master/ScheduleView/SpecialSlotsToolTip

The approach from the example combined with the approach demonstrated in this thread should help you to achieve the desired (you would need to register the ClassHandler for elements of type HighlightItem).

Hope this will work for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ScheduleView
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Christie Admin
Top achievements
Rank 1
Share this question
or