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

Tooltip duration time

4 Answers 524 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Amige
Top achievements
Rank 1
Veteran
Amige asked on 13 Mar 2015, 02:07 AM
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

4 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 17 Mar 2015, 01:24 PM
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.

 
0
Amige
Top achievements
Rank 1
Veteran
answered on 20 Mar 2015, 06:04 PM
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
0
Accepted
Sia
Telerik team
answered on 21 Mar 2015, 04:03 PM
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.

 
0
Amige
Top achievements
Rank 1
Veteran
answered on 23 Mar 2015, 08:43 PM
Hello Sia,

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

Regards,

Alberto
Tags
TimeLine
Asked by
Amige
Top achievements
Rank 1
Veteran
Answers by
Sia
Telerik team
Amige
Top achievements
Rank 1
Veteran
Share this question
or