Interactive ToolTip

6 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 21 May 2014 Link to this post

    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
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 23 May 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 23 May 2014 in reply to Kalin Link to this post

    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
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 27 May 2014 Link to this post

    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.
     
  6. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 16 Jun 2014 Link to this post

    Hi Kalin,

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

    Thank's
    Alain
  7. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 18 Jun 2014 Link to this post

    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.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready