Hi support,
My requirement is something like this I want to show some information into it also. Like appointment starting time, appointment end time and subject. Also want to differentiate appointment on different condition using different color..
With all this one new requirement is there if some user don't have permission for delete the appointment then he/she can't see delete button on appointment.
I have done following things for this.
Used Appointment template selector class in which on different condition different template applied.One example of template is as below.
<DataTemplate x:Key="SimpleAppointmentTemplate">
<Border x:Name="XamlBorder"
Margin="-2">
<Grid>
<ToolTipService.ToolTip>
<StackPanel Orientation="Vertical"
MaxWidth="225"
MaxHeight="225">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Start, StringFormat=\{0:HH:mm\}}" />
<TextBlock Text="-" />
<TextBlock Text="{Binding End, StringFormat=\{0:HH:mm\}}" />
</StackPanel>
<TextBlock Text="{Binding Subject}"
TextWrapping="Wrap" />
</StackPanel>
</ToolTipService.ToolTip>
<TextBlock Text=""
Width="1000" />
<TextBlock x:Name="XamlSubjectTextBlock"
Margin="7 0 18 0"
Width="{Binding Width, ElementName=XamlBorder}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
TextTrimming="WordEllipsis"
Text="{Binding Subject}"
Foreground="Black"
TextWrapping="Wrap" />
</Grid>
</Border>
</DataTemplate>
As shown in bold color I show start and end time with subject in tooltip and only subject in appointment. Here I differentiate appointment by foreground color. Like for simple appointment Black , Ongoing appointment Green, late started appointment Red etc....
This all is maintain by Appointment Template selector class.
Now I want to hide delete button so I have post to teleik and got replied that I should use appointmentStyleSeletor class and in that remove or hide that delete button for that style. So for that I have done as below.
<ControlTemplate x:Key="AppointmentItemHorizontalControlTemplate"
TargetType="telerikWindowsControls:AppointmentItem">
</ControlTemplate>
<Style x:Key="XamlWithOutDeleteButtonStyle" TargetType="telerikWindowsControls:AppointmentItem">
<Setter Property="Template"
Value="{StaticResource AppointmentItemHorizontalControlTemplate}" />
<Setter Property="Canvas.ZIndex"
Value="1" />
</Style>
<localScheduler:AppointmnetStyleSelector x:Name="StyleSelector1" WithOutDeleteButtonStyle ="{StaticResource XamlWithOutDeleteButtonStyle}" />
From AppointmnetStyleSelector class as per condition I select this style and delete button gone. but now the problem is I am not able to get the template for this. I mean this style override my template . All apointments are shown with black foreground color.
how can I resolve this ? Can you please create one example related to that? Is it need to use both class for my requirement ? Or It can be solved with one class only.?
Thanks
H@rdik Pancholi
My requirement is something like this I want to show some information into it also. Like appointment starting time, appointment end time and subject. Also want to differentiate appointment on different condition using different color..
With all this one new requirement is there if some user don't have permission for delete the appointment then he/she can't see delete button on appointment.
I have done following things for this.
Used Appointment template selector class in which on different condition different template applied.One example of template is as below.
<DataTemplate x:Key="SimpleAppointmentTemplate">
<Border x:Name="XamlBorder"
Margin="-2">
<Grid>
<ToolTipService.ToolTip>
<StackPanel Orientation="Vertical"
MaxWidth="225"
MaxHeight="225">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Start, StringFormat=\{0:HH:mm\}}" />
<TextBlock Text="-" />
<TextBlock Text="{Binding End, StringFormat=\{0:HH:mm\}}" />
</StackPanel>
<TextBlock Text="{Binding Subject}"
TextWrapping="Wrap" />
</StackPanel>
</ToolTipService.ToolTip>
<TextBlock Text=""
Width="1000" />
<TextBlock x:Name="XamlSubjectTextBlock"
Margin="7 0 18 0"
Width="{Binding Width, ElementName=XamlBorder}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
TextTrimming="WordEllipsis"
Text="{Binding Subject}"
Foreground="Black"
TextWrapping="Wrap" />
</Grid>
</Border>
</DataTemplate>
As shown in bold color I show start and end time with subject in tooltip and only subject in appointment. Here I differentiate appointment by foreground color. Like for simple appointment Black , Ongoing appointment Green, late started appointment Red etc....
This all is maintain by Appointment Template selector class.
Now I want to hide delete button so I have post to teleik and got replied that I should use appointmentStyleSeletor class and in that remove or hide that delete button for that style. So for that I have done as below.
<ControlTemplate x:Key="AppointmentItemHorizontalControlTemplate"
TargetType="telerikWindowsControls:AppointmentItem">
</ControlTemplate>
<Style x:Key="XamlWithOutDeleteButtonStyle" TargetType="telerikWindowsControls:AppointmentItem">
<Setter Property="Template"
Value="{StaticResource AppointmentItemHorizontalControlTemplate}" />
<Setter Property="Canvas.ZIndex"
Value="1" />
</Style>
<localScheduler:AppointmnetStyleSelector x:Name="StyleSelector1" WithOutDeleteButtonStyle ="{StaticResource XamlWithOutDeleteButtonStyle}" />
From AppointmnetStyleSelector class as per condition I select this style and delete button gone. but now the problem is I am not able to get the template for this. I mean this style override my template . All apointments are shown with black foreground color.
how can I resolve this ? Can you please create one example related to that? Is it need to use both class for my requirement ? Or It can be solved with one class only.?
Thanks
H@rdik Pancholi