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

How to apply custom Appointment Tooltip

7 Answers 385 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Rod Yager
Top achievements
Rank 1
Rod Yager asked on 14 Feb 2011, 10:29 PM
The custom toolip example has a TargetType and no key so it overrides all tooltips. How can I just target the Appointment with a custom toolip?

Thanks,
Rod

7 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 16 Feb 2011, 02:32 PM
Hello Rod,

True, the Custom ToolTip example contains a style that will try to get applied to all tooltips in the application. In the case of the example, it is  ok, but if you wish to use it on an appointment item only, you have two options:

1) Use ToolTipTemplate property on ScheduleView and provide a tooltip DataTemplate for all appointments

2) Use AppointmentStyleSelector and provide different styles for appointments. Each style contains a different custom tooltip. The thing to note here is that the tooltip is inserted into the appointment style with ToolTipService.ToolTip.
An example of this particular approach will be released with Q1 Beta, that is expected this week - ScheduleView FirstLook example for Silverlight. The WPF approach is the same.

The second approach would be fit in case you have custom appointments.

I hope this helps.

Best wishes,
Dani
the Telerik team
0
Rod Yager
Top achievements
Rank 1
answered on 23 Mar 2011, 10:09 PM
Can someone provide a couple of default styles for AppointmentItem to customize for the AppointmentStyleSelector? One for vertical and horizontal. I tried getting it from expression but encounter the following errors with some of the style objects.

Error 109 The tag 'ChromeControl' does not exist in XML namespace 'http://schemas.telerik.com/2008/xaml/presentation'.

Error 116 The type 'telerik:AppointmentSlotPresenter' was not found.

Also, I noticed that the default tooltip behavior is just to show the "Subject" string on the appointment. If I could just ovveride that with an object of my choice during runtime that would be ideal.

Thanks,
Rod
0
Dani
Telerik team
answered on 28 Mar 2011, 04:06 PM
Hi Rod,

Please, find attached a sample containing AppointmentItemStyleSelector  with a base, horizontal and vertical style as well as a  custom tooltip.

You can basically add any element you like to the horizontal and vertical control templates of the AppointmentItem to have a custom ToolTip. You can bind that element to other properties of the Appointment besides the Subject - Body (the desciption text), StartTime, EndTime, etc.

I hope this helps.

Regards,
Dani
the Telerik team
0
Rod Yager
Top achievements
Rank 1
answered on 25 Jul 2011, 07:42 PM
Using the ToolTipTemplate method, is there any way to control how long the Tooltip appears using the the ToolTipService. Not sure how to implement this.
Thanks,
Rod
0
Dani
Telerik team
answered on 27 Jul 2011, 11:10 AM
Hello Rod,

You simply need to add a TextWrapping="Wrap" and a Width / MinWidth / MaxWidth property to the TextBlock you want to wrap.
Consider this example:

<ControlTemplate x:Key="MyToolTipTemplate" TargetType="ToolTip">
            <Grid Height="180" Width="330">
                <Border CornerRadius="2" BorderBrush="DarkBlue" Background="Blue">
                    <StackPanel Orientation="Horizontal" Margin="10">
                        <TextBlock MaxWidth="200" TextWrapping="Wrap" Text="{Binding Subject}"/>
                    </StackPanel>
                </Border>
            </Grid>
        </ControlTemplate>
          
        <Style x:Key="AppoinmentToolTipStyle" TargetType="ToolTip">
            <Setter Property="Template" Value="{StaticResource MyToolTipTemplate}" />
        </Style>
          
        <ControlTemplate x:Key="AppointmentItemVerticalControlTemplate" TargetType="telerik:AppointmentItem">
            <Grid x:Name="Root">
                <ToolTipService.ToolTip>
                    <ToolTip Style="{StaticResource AppoinmentToolTipStyle}"/>
                </ToolTipService.ToolTip>
     
 .... 
  
</ControlTemplate>

I hope this helps.

Kind regards,
Dani
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Rod Yager
Top achievements
Rank 1
answered on 27 Jul 2011, 02:03 PM
You must have misunderstood what I was asking. I am using the ScheduleView.ToolTipTemplate to specify a tooltip for Appointments. What I would like is to control how long the tooltip displays. ie ToolTipService.SetShowDuration.
Rod
0
Dani
Telerik team
answered on 28 Jul 2011, 11:48 AM
Hello Rod,

Luckily, controling duration and display delay of tooltips is a feature available for WPF only. Use the ToolTipService.ShowDuration attached property to configure how long your tooltip will be visible.
 
To accomplish that you need to:

- Cancel the display of the default tooltip:
<!-- NOTE: Hide the default tooltip-->
        <Style x:Key="RadScheduleViewStyle" TargetType="telerik:RadScheduleView">
            <Setter Property="ToolTipTemplate" Value="{x:Null}" />
        </Style>

- Use the AppointmentStyleSelector in order to be able to modify the appointment templates for both the horizontal and vertical orientation

- Inside the appointment template specify your own tooltip including the duration and ,if you need, the delay attached properties:
<ControlTemplate x:Key="AppointmentItemHorizontalControlTemplate" TargetType="scheduleView:AppointmentItem">
            <Grid x:Name="Root" ToolTipService.InitialShowDelay="4000" ToolTipService.ShowDuration="6000">                
                <!--NOTE: add the tooltip-->
                <ToolTipService.ToolTip>
                    <TextBlock Text="My ToolTip" />
                </ToolTipService.ToolTip>
...
</ControlTemplate>

Just remember that ToolTipService.ShowDuration is set on the object that contains the tooltip. Also, please note that you need to add that to both the horizontal and vertical templates.

I hope this will be helpful.

Kind regards,
Dani
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ScheduleView
Asked by
Rod Yager
Top achievements
Rank 1
Answers by
Dani
Telerik team
Rod Yager
Top achievements
Rank 1
Share this question
or