Hi,
I've got the following scenario:
- I'm using the ScheduleView and I customized the AppointmentItem (removed close button, changed most of the borders, etc, appointments now strait lines )
- I also customized the tooltip
The only thing I wasn't able to do was to set the tooltip duration:
Here's what I'm doing in XAML:
Definition of schedule View:
Definition of tooltip template:
Definition of CustomAppointmentStyleSelected in XAML:
In code behind:
So, I want to show the tooltip when the mouse is over the appointment and I want it to be open for 20 seconds with the format defined in the template. Is this possible?
The example that almost worked was when I set this on the schedule View:
and then:
this solution will show the tooltip for 20 seconds but without the information that I want and how I want it (don't know how to set the format of the tooltip using this Setter and Value) and worst of all, the tooltip appears on the top left of the screen, not where the mouse exists.
Could you please help me?
Thanks,
L. Pinho
I've got the following scenario:
- I'm using the ScheduleView and I customized the AppointmentItem (removed close button, changed most of the borders, etc, appointments now strait lines )
- I also customized the tooltip
The only thing I wasn't able to do was to set the tooltip duration:
Here's what I'm doing in XAML:
Definition of schedule View:
<
telerik:RadScheduleView
x:Name
=
"scheduleView"
AppointmentsSource
=
"{Binding States}"
CurrentDate
=
"{Binding CurrentDate}"
CategoriesSource
=
"{Binding Categories}"
ResourceTypesSource
=
"{Binding AllResourceTypesInCurrentContext}"
ShowDialog
=
"scheduleView_ShowDialog"
AllowDrop
=
"False"
AppointmentNavigationButtonsVisibility
=
"Never"
NavigationHeaderVisibility
=
"Collapsed"
ShowCurrentTimeIndicator
=
"False"
AppointmentStyleSelector
=
"{StaticResource CustomAppointmentStyleSelector}"
ToolTipTemplate
=
"{StaticResource AppointmentToolTipTemplate}"
SizeChanged
=
"scheduleView_SizeChanged"
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:ResourceGroupDescription
ResourceType
=
"Equipment"
/>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:RadScheduleView.GroupHeaderContentTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding FormattedName}"
Width
=
"80"
Margin
=
"8 0"
VerticalAlignment
=
"Center"
/>
</
DataTemplate
>
</
telerik:RadScheduleView.GroupHeaderContentTemplate
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:TimelineViewDefinition
x:Name
=
"timeLineViewDefinition"
VisibleDays
=
"{Binding NumberOfDays}"
MinTimeRulerExtent
=
"1"
TimerulerGroupStringFormat
=
"{}{0:MM/dd/yyyy}"
TimerulerMajorTickStringFormat
=
"{}{0:hh:mm tt}"
></
telerik:TimelineViewDefinition
>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
Definition of tooltip template:
<
DataTemplate
x:Key
=
"AppointmentToolTipTemplate"
>
<
Grid
MaxWidth
=
"700"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"43"
/>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Text
=
"{Binding Subject}"
Grid.ColumnSpan
=
"2"
TextWrapping
=
"Wrap"
Margin
=
"5 8 4 3"
FontWeight
=
"Bold"
/>
<
Canvas
Grid.Row
=
"1"
x:Name
=
"appbar_clock"
Width
=
"50"
Height
=
"50"
Clip
=
"F1 M 0,0L 50,0L 50,50L 0,50L 0,0"
>
<
Path
Width
=
"34.8333"
Height
=
"34.8333"
Canvas.Left
=
"5"
Canvas.Top
=
"5"
Stretch
=
"Fill"
Fill
=
"#FF1e395b"
Data
=
"F1 M 38,23.75C 46.7445,23.75 53.8333,30.8388 53.8333,39.5833C 53.8333,48.3278 46.7445,55.4167 38,55.4167C 29.2555,55.4167 22.1667,48.3278 22.1667,39.5833C 22.1667,30.8388 29.2555,23.75 38,23.75 Z M 38,27.7083C 31.4416,27.7083 26.125,33.025 26.125,39.5833C 26.125,46.1417 31.4416,51.4583 38,51.4583C 44.5584,51.4583 49.875,46.1417 49.875,39.5833C 49.875,33.025 44.5584,27.7083 38,27.7083 Z M 37.6042,30.875C 38.4786,30.875 39.1875,31.5839 39.1875,32.4583L 39.1875,38.3959L 45.125,38.3959C 45.9994,38.3959 46.7083,39.1047 46.7083,39.9792L 46.7083,40.7708C 46.7083,41.6453 45.9994,42.3542 45.125,42.3542L 38,42.3542C 37.2083,42.2222 36.4167,42.0903 35.9548,41.6285C 35.493,41.1667 35.3611,40.375 35.2292,39.5833L 35.2292,32.4583C 35.2292,31.5839 35.938,30.875 36.8125,30.875L 37.6042,30.875 Z"
/>
</
Canvas
>
<
StackPanel
Orientation
=
"Vertical"
Grid.Column
=
"1"
Grid.Row
=
"1"
Margin
=
"5 0 0 0"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
FontWeight
=
"Bold"
Text
=
"{Binding Path=StartAppointment, Source={StaticResource res}}"
MinWidth
=
"40"
Margin
=
"0 5"
FontSize
=
"10"
/>
<
TextBlock
Text
=
"{Binding Start, StringFormat='yyyy/MM/dd hh:mm tt'}"
Margin
=
"0 5"
FontSize
=
"10"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
FontWeight
=
"Bold"
Text
=
"{Binding Path=EndAppointment, Source={StaticResource res}}"
MinWidth
=
"40"
Margin
=
"0"
FontSize
=
"10"
/>
<
TextBlock
Text
=
"{Binding End, StringFormat='yyyy/MM/dd hh:mm tt'}"
Margin
=
"0"
FontSize
=
"10"
/>
</
StackPanel
>
</
StackPanel
>
<
TextBlock
Grid.Row
=
"2"
Grid.ColumnSpan
=
"2"
Text
=
"{Binding Body}"
Margin
=
"5 0 5 8"
TextWrapping
=
"Wrap"
FontSize
=
"10"
/>
</
Grid
>
</
DataTemplate
>
Definition of CustomAppointmentStyleSelected in XAML:
<
local:CustomAppointmentStyleSelector
x:Key
=
"CustomAppointmentStyleSelector"
>
<
local:CustomAppointmentStyleSelector.CustomHorizontalStyle
>
<
Style
TargetType
=
"telerik:AppointmentItem"
BasedOn
=
"{StaticResource AppointmentItemBaseStyle}"
>
<
Setter
Property
=
"telerik:RadToolTipService.ShowDuration"
Value
=
"20000"
/>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource AppointmentItemHorizontalControlTemplate}"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Transparent"
/>
</
Style
>
</
local:CustomAppointmentStyleSelector.CustomHorizontalStyle
>
</
local:CustomAppointmentStyleSelector
>
In code behind:
/// <summary>
/// Helper class to set custom appointment style
/// </summary>
public
class
CustomAppointmentStyleSelector : OrientedAppointmentItemStyleSelector
{
public
Style CustomHorizontalStyle {
get
;
set
; }
public
Style CustomVerticalStyle {
get
;
set
; }
public
override
Style SelectStyle(
object
item, DependencyObject container, ViewDefinitionBase activeViewDefinition)
{
if
(activeViewDefinition.GetOrientation() == Orientation.Horizontal)
{
CustomHorizontalStyle.SetValue(RadToolTipService.ShowDurationProperty, 20000);
return
this
.CustomHorizontalStyle;
}
else
if
(activeViewDefinition.GetOrientation() == Orientation.Vertical)
{
return
this
.CustomVerticalStyle;
}
return
base
.SelectStyle(item, container, activeViewDefinition);
}
}
So, I want to show the tooltip when the mouse is over the appointment and I want it to be open for 20 seconds with the format defined in the template. Is this possible?
The example that almost worked was when I set this on the schedule View:
ToolTipTemplate="{x:Null}"
<
local:CustomAppointmentStyleSelector
x:Key
=
"CustomAppointmentStyleSelector"
>
<
local:CustomAppointmentStyleSelector.CustomHorizontalStyle
>
<
Style
TargetType
=
"telerik:AppointmentItem"
BasedOn
=
"{StaticResource AppointmentItemBaseStyle}"
>
<
Setter
Property
=
"telerik:RadToolTipService.ShowDuration"
Value
=
"20000"
/>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource AppointmentItemHorizontalControlTemplate}"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Transparent"
/>
<
Setter
Property
=
"telerik:RadToolTipService.ToolTipContent"
Value
=
"{Binding Subject}"
/>
</
Style
>
</
local:CustomAppointmentStyleSelector.CustomHorizontalStyle
>
</
local:CustomAppointmentStyleSelector
>
this solution will show the tooltip for 20 seconds but without the information that I want and how I want it (don't know how to set the format of the tooltip using this Setter and Value) and worst of all, the tooltip appears on the top left of the screen, not where the mouse exists.
Could you please help me?
Thanks,
L. Pinho