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

Need help with appointment style/template

3 Answers 299 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 03 Feb 2011, 08:12 PM
Hi everyone,
  with the new scheduleview, I was wondering how do I set easily the template(data template) inside the appointment item without having to redefine completely the control template.

In RadScheduler, you could set the appointment template property easily and keep the appointment item( background, mouse over etc....) behavior and only override the content.

However with the new scheduleview, I have some trouble to accomplish this. I was able to use the AppointmentStyleSelector but the result was only a flat datatemplate with no border, color resizing anchor etc....

If you have any hint, it would be appreciated.

thx

3 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 03 Feb 2011, 08:58 PM
I did find a way now to put my own template using the selector without having to redefine the Control template.

<telerik:OrientedAppointmentItemStyleSelector x:Key="ScheduleViewStyleSelector1">
            <telerik:OrientedAppointmentItemStyleSelector.VerticalStyle>
                <Style TargetType="telerik:AppointmentItem">
                    <Setter Property="ContentTemplate" Value="{StaticResource BFAppointmentTemplate}"/>
                </Style>
            </telerik:OrientedAppointmentItemStyleSelector.VerticalStyle>
        </telerik:OrientedAppointmentItemStyleSelector>   

However..... the resizing dots are on the right/left side of the appointment instead of top/bottom. I'm pretty sure I'm missing something but what.....

Any clues would be appreciated. I'll continue looking.
0
Mike
Top achievements
Rank 1
answered on 03 Feb 2011, 09:59 PM
Well, in the WPF doc, it seems there is an <orientation> property available but I can't find a way to set it in silverlight.

Edit: Nevermind, it was in the RadScheduler assembly and not in the radscheduleview.
Edit2: I found the XAML for the style.

<ControlTemplate x:Key="AppointmentItemVerticalControlTemplate" TargetType="telerik:AppointmentItem">
            <Grid x:Name="Root">
                <telerik:CommandManager.InputBindings>
                    <telerik:InputBindingCollection>
                        <telerik:MouseBinding Command="local:RadScheduleViewCommands.EditAppointment" Gesture="LeftDoubleClick"/>
                    </telerik:InputBindingCollection>
                </telerik:CommandManager.InputBindings>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0.200" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverOverlay">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.200">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Collapsed</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation BeginTime="0:0:0.0" Duration="0:0:0.200" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverOverlay"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="MouseOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0.400" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverOverlay">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation BeginTime="0:0:0.200" Duration="0:0:0.200" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverOverlay"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="SelectionStates">
                        <VisualState x:Name="Unselected"/>
                        <VisualState x:Name="Selected">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="CommonStatesVisual">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Background" Storyboard.TargetName="CommonStatesVisual">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource AppointmentItemBackground_Selected}"/>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="CommonStatesVisual">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource AppointmentItemOuterBorder_Selected}"/>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="CommonStatesVisualInnerBorder">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource AppointmentItemInnerBorder_Selected}"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2">
                    <Border BorderBrush="{StaticResource AppointmentItemInnerBorder}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"/>
                </Border>
                <Border x:Name="CommonStatesVisual" BorderBrush="{StaticResource AppointmentItemOuterBorder_MouseOver}" BorderThickness="{TemplateBinding BorderThickness}" Background="{StaticResource AppointmentItemBackground_MouseOver}" CornerRadius="2" Visibility="Collapsed">
                    <Border x:Name="CommonStatesVisualInnerBorder" BorderBrush="{StaticResource AppointmentItemInnerBorder_MouseOver}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"/>
                </Border>
                <Border x:Name="PART_Category" Background="{Binding Category.CategoryBrush}" Margin="2"/>
                <Border x:Name="PART_TimeMarker" Background="{Binding TimeMarker.TimeMarkerBrush}" HorizontalAlignment="Left" Margin="2" Width="5"/>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="0" HorizontalAlignment="Left" Height="10" Margin="4 4 0 0" Source="/Telerik.Windows.Controls.ScheduleView;component/Themes/Images/AppointmentException.png" Visibility="{Binding RecurrenceState, Converter={StaticResource RecurrenceStateIsExeptionToVisibilityConverter}}" VerticalAlignment="Top" Width="10"/>
                    <Image Grid.Column="0" HorizontalAlignment="Left" Height="10" Margin="4 4 0 0" Source="/Telerik.Windows.Controls.ScheduleView;component/Themes/Images/AppointmentRecurrence.png" Visibility="{Binding RecurrenceState, Converter={StaticResource RecurrenceStateIsOccurenceToVisibilityConverter}}" VerticalAlignment="Top" Width="10"/>
                    <ContentPresenter Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Grid>
                <Grid x:Name="MouseOverOverlay" Opacity="0" Visibility="Collapsed">
                    <Border x:Name="PART_StartResizeGrip" telerik:RadDragAndDropManager.AllowDrag="true" Background="Transparent" Cursor="SizeNS" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                        <StackPanel x:Name="StartResizeGrip" HorizontalAlignment="Center" Margin="1" Orientation="Horizontal" VerticalAlignment="Center">
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                        </StackPanel>
                    </Border>
                    <Border x:Name="PART_EndResizeGrip" telerik:RadDragAndDropManager.AllowDrag="true" Background="Transparent" Cursor="SizeNS" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
                        <StackPanel x:Name="EndResizeGrip" HorizontalAlignment="Center" Margin="1" Orientation="Horizontal" VerticalAlignment="Center">
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                            <Border BorderBrush="{StaticResource AppointmentItemResizeGripStroke}" BorderThickness="0,0,1,1" Background="{StaticResource AppointmentItemResizeGripBackground}" Height="3" Margin="1" Width="3"/>
                        </StackPanel>
                    </Border>
                </Grid>
            </Grid>
        </ControlTemplate>




0
Pana
Telerik team
answered on 09 Feb 2011, 11:02 AM
Hello Mike,

I am glad you have figured it out. If you have further problems please do not hesitate to contact us.

All the best,
Pana
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
ScheduleView
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Pana
Telerik team
Share this question
or