Tooltip duration time

5 posts, 1 answers
  1. Amige
    Amige avatar
    44 posts
    Member since:
    Dec 2013

    Posted 12 Mar 2015 Link to this post

    Hello,

    I am using a ToolTip Template to show some information related to the items in a Timeline control.

    I'd like to increase the amount of time that a tooltip remains visible, I am using the property ToolTipService.ShowDuration but when I change its value it seems it doesn't have effect on the time that the tooltip remains visible.

    Is there a way achieve this?

    Thanks,

    Alberto
  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 17 Mar 2015 Link to this post

    Hello Amige,

    You should set the TooltipService.ShowDuration property on the object having the Tooltip - in the context of TimeLine these are TimeLineItems. So, in your case you should set it in the InstantItemTemplate and ItemWithDurationTemplate: 

    <DataTemplate x:Key="InstantItemTemplate">
        <Border Width="10" Height="100" Margin="0,0,0,5"                  
                ToolTipService.ShowDuration="300"   
                ToolTipService.ToolTip="{Binding DataItem.Date}" >
            <Rectangle Height="40"
                Width="40"                         
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Fill="Red">
            </Rectangle>
        </Border>
    </DataTemplate>
    • Another option is to use the same approach but using RadTooltip. You can find it in the attached solution below the <!-- When using RadTooltip --> comment.
    • Another option is also to set implicit styles with the needed setters as follows:
    <Style TargetType="telerik:TimelineInstantItemControl" BasedOn="{StaticResource TimelineInstantItemControlStyle}">
        <Setter Property="ToolTipService.ShowDuration" Value="200" />
        <Setter Property="ToolTipService.ToolTip" Value="ToolTip" />
    </Style>
    You can find them in the attached solution below the <!-- When using implicit styles --> comment.

    Please find the sample application attached to this thread. 

    Regards,
    Sia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Amige
    Amige avatar
    44 posts
    Member since:
    Dec 2013

    Posted 20 Mar 2015 in reply to Sia Link to this post

    Hello Sia,

    Thanks for the sample application, it seems pretty easy to implement, but I still can't make it work on my project, let me tell you a little bit about my scenario:

    I have a RadTimeline control which has a TimelineItemTemplate and a ToolTipTemplate, something like this:

    <telerik:RadTimeline x:Name="myTimeline"                                     
                         PeriodStart="{Binding PeriodStart}"
                         PeriodEnd="{Binding PeriodEnd}"
                         VisiblePeriodStart="{Binding VisiblePeriodStart, Mode=TwoWay}"
                         VisiblePeriodEnd="{Binding VisiblePeriodEnd, Mode=TwoWay}"
                         StartPath="StartDate"
                         DurationPath="Duration"   
                         TimelineItemTemplate="{StaticResource myItemTemplate}"
                         ItemsSource="{Binding myData}">
                          
         <telerik:RadTimeline.ToolTipTemplate>
            <DataTemplate>
                <Grid>
                    <!--Some TextBlocks and Borders to show the information-->
                </Grid>
            </DataTemplate>
        </telerik:RadTimeline.ToolTipTemplate>
         
    </telerik:RadTimeline>

    My TimelineItemTemplate:

    class CustomTimelineControl : TimelineItemControlBase
        {
            public CustomTimelineControl()
            {
            }   
        }
    <DataTemplate x:Key="myItemTemplate">
        <controls:CustomTimelineControl Style="{StaticResource myStyle}"/>
    </DataTemplate>
    <Style x:Key="myStyle" TargetType="controls:CustomTimelineControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:CustomTimelineControl">
                    <Border ToolTipService.ShowDuration="2000">
                        <!--Some controls to customize the items-->
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    In that style is where I am setting the ShowDuration property, but when I run the application it seems that it doesn't work.

    Thanks,

    Alberto
  5. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 21 Mar 2015 Link to this post

    Hello again,

    You are right that if you use the exposed TooltipTemplate property of the Timeline control, there is no easy way to manipulate the duration. Please check the attached project and let me know whether setting the template to the items but not the Timeline is appropriate for your solution.

    Regards,
    Sia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Amige
    Amige avatar
    44 posts
    Member since:
    Dec 2013

    Posted 23 Mar 2015 in reply to Sia Link to this post

    Hello Sia,

    Thanks again for the sample project, that works for me.

    Regards,

    Alberto
Back to Top
UI for WPF is Visual Studio 2017 Ready