AppointmentViewInfoCustomizingEventArgs Class
Namespace: DevExpress.Xpf.Scheduler
Assembly:
DevExpress.Xpf.Scheduler.v14.2.dll
#Declaration
public class AppointmentViewInfoCustomizingEventArgs :
EventArgs
Public Class AppointmentViewInfoCustomizingEventArgs
Inherits EventArgs
Note that AppointmentViewInfoCustomizingEventArgs objects are automatically created, initialized and passed to the SchedulerControl.AppointmentViewInfoCustomizing event handlers.
#Examples
This example demonstrates how to use the AppointmentViewInfo.Subject, AppointmentViewInfo.Location, AppointmentViewInfo.Description, AppointmentViewInfo.CustomViewInfo, SchedulerViewBase.AppointmentToolTipContentTemplate properties and SchedulerControl.AppointmentViewInfoCustomizing event to define and apply a custom template for showing an appointment subject, location, description and resource images within appointment tooltips.
using System;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using DevExpress.XtraScheduler;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Drawing;
namespace SilverlightApplication1 {
public partial class MainPage : UserControl {
Dictionary<Resource, BitmapImage> resourceImages = new Dictionary<Resource, BitmapImage>();
public MainPage() {
InitializeComponent();
DataTemplate template = (DataTemplate)this.Resources["AppointmentTooltipContentTemplate"];
schedulerControl1.WeekView.AppointmentToolTipContentTemplate = template;
}
private void schedulerControl1_AppointmentViewInfoCustomizing(object sender,
AppointmentViewInfoCustomizingEventArgs e) {
AppointmentViewInfo viewInfo = e.ViewInfo;
Resource resource = schedulerControl1.Storage.ResourceStorage.
GetResourceById(viewInfo.Appointment.ResourceId);
if (resource == Resource.Empty || resource.Image == null)
viewInfo.CustomViewInfo = null;
else {
if (!this.resourceImages.ContainsKey(resource))
this.resourceImages[resource] = resource.Image.Source as BitmapImage;
viewInfo.CustomViewInfo = this.resourceImages[resource];
}
}
}
}
Imports System
Imports System.Windows.Controls
Imports System.Windows.Media.Imaging
Imports DevExpress.XtraScheduler
Imports DevExpress.Xpf.Scheduler
Imports DevExpress.Xpf.Scheduler.Drawing
Partial Public Class MainPage
Inherits UserControl
Private resourceImages As Dictionary(Of Resource, BitmapImage) = New Dictionary(Of Resource, _
BitmapImage)()
Public Sub New()
InitializeComponent()
Dim template As DataTemplate = CType(Me.Resources("AppointmentTooltipContentTemplate"), _
DataTemplate)
schedulerControl1.WeekView.AppointmentToolTipContentTemplate = template
End Sub
Private Sub schedulerControl1_AppointmentViewInfoCustomizing(sender As Object, _
e As AppointmentViewInfoCustomizingEventArgs)
Dim viewInfo As AppointmentViewInfo = e.ViewInfo
Dim resource As Resource = _
schedulerControl1.Storage.ResourceStorage.GetResourceById(viewInfo.Appointment.ResourceId)
If resource Is resource.Empty OrElse resource.Image Is Nothing Then
viewInfo.CustomViewInfo = Nothing
Else
If (Not Me.resourceImages.ContainsKey(resource)) Then
Me.resourceImages(resource) = TryCast(resource.Image.Source, BitmapImage)
End If
viewInfo.CustomViewInfo = Me.resourceImages(resource)
End If
End Sub
End Class
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"
xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
xmlns:local="clr-namespace:SilverlightApplication1.Web"
mc:Ignorable="d"
d:DesignHeight="478" d:DesignWidth="590">
<UserControl.Resources>
<DataTemplate x:Key="AppointmentTooltipContentTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="AUTO"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="2" Margin="2" BorderThickness="1"
BorderBrush="DarkGray" CornerRadius="2">
<Image Stretch="Uniform"
MaxWidth="140" MaxHeight="100"
Source="{Binding Path=CustomViewInfo}"/>
</Border>
<TextBlock Grid.Column="1" Text="{Binding Path=Subject}"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Location}"/>
<TextBlock Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Path=Description}"/>
</Grid>
</DataTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<dxsch:SchedulerControl Name="schedulerControl1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ActiveViewType="Week"
GroupType="None"
AppointmentViewInfoCustomizing="schedulerControl1_AppointmentViewInfoCustomizing">
<dxsch:SchedulerControl.Storage>
</dxsch:SchedulerControl.Storage>
</dxsch:SchedulerControl>
</Grid>
</UserControl>
See Also