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

Appointments not updated on view when source is updated

4 Answers 167 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
JiFong Chen
Top achievements
Rank 1
JiFong Chen asked on 03 Oct 2011, 10:58 PM
Hi there,

I am using RadScheduleView version 2011.2.920.40 with ViewModel style.

XAML:
AppointmentsSource="{Binding StaffAppointments}" ResourceTypesSource="{Binding StaffResourcesTypes}"

The appointments are not updated on the view when AppointmentsSource is updated. Unless I click on WeeklyView then back to TimelineView, and the appointments are updated on the UI.

I thought this problem has been addressed?
http://www.telerik.com/community/forums/preview-thread/wpf/scheduleview/appointments-not-update-on-view-when-source-is-updated.aspx

Please advise.

4 Answers, 1 is accepted

Sort by
0
JiFong Chen
Top achievements
Rank 1
answered on 06 Oct 2011, 04:43 AM
Any ideas?

Some appointment display the same Subject, but when you mouse-over them, the tooltip shows different thing.
0
Rosi
Telerik team
answered on 06 Oct 2011, 10:40 AM
Hello Jifong,

This problems appears sometimes when a custom appointment style is used. Do you use a custom appointment style or template for the AppointmentItem? If yes, I suggest you post it here so we can review it.

All the best,
Rosi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
JiFong Chen
Top achievements
Rank 1
answered on 07 Oct 2011, 01:45 AM
Hi Rosi,

Yes, I am using Custom Appointment Style for AppointmentItem.

<Style x:Key="RentalAllocationStyle" TargetType="{x:Type telerik:AppointmentItem}">
    <Setter Property="Margin" Value="0,1,0,0"/>
    <Style.BasedOn>
        <Style TargetType="{x:Type telerik:AppointmentItem}">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="SteelBlue"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="FontSize" Value="10"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="BorderBrush" Value="#FF848484"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="2,0,0,0"/>
            <Setter Property="Focusable" Value="True"/>
            <Setter Property="ContentTemplateSelector">
                <Setter.Value>
                    <telerik:AppointmentItemContentTemplateSelector>
                        <telerik:AppointmentItemContentTemplateSelector.DefaultTemplate>
                            <DataTemplate>
                                <TextBlock telerik:DragDropManager.AllowDrag="False" TextWrapping="Wrap" Text="{Binding Subject}" TextTrimming="WordEllipsis"/>
                            </DataTemplate>
                        </telerik:AppointmentItemContentTemplateSelector.DefaultTemplate>
                    </telerik:AppointmentItemContentTemplateSelector>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type telerik:AppointmentItem}">
                        <Grid x:Name="Root">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border x:Name="DurationMarkerVisual" Margin="{TemplateBinding DurationMarkerMargin}" Visibility="{TemplateBinding DurationMarkerVisibility}">
                                <Border Background="#FF848484" CornerRadius="1,1,0,0" Height="4" Margin="0,0,0,-1"/>
                            </Border>
                            <Grid Grid.Row="1">
                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2">
                                    <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"/>
                                </Border>
                                <Border x:Name="CommonStatesVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" Visibility="Collapsed">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFFBA3" Offset="1"/>
                                            <GradientStop Color="#FFFFFBDA" Offset="0"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Border x:Name="CommonStatesVisualInnerBorder" BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"/>
                                </Border>
                                <Border x:Name="PART_Category" Background="{Binding Category.CategoryBrush}" Margin="2"/>
                                <Rectangle x:Name="ReadOnlyVisual" Fill="#B2BABFC6" Margin="2" Visibility="Collapsed"/>
                                <Grid Margin="2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Border x:Name="PART_TimeMarker" Background="{Binding TimeMarker.TimeMarkerBrush}" Grid.Column="0" HorizontalAlignment="Left" Width="5">
                                        <Border.Visibility>
                                            <Binding Path="TimeMarker">
                                                <Binding.Converter>
                                                    <telerik:NullToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </Border.Visibility>
                                    </Border>
                                    <Path Grid.Column="1" Data="M-919.69031,2003.9496L-919.69031,2010.7375 -923.7619,2007.4564z" Fill="Black" HorizontalAlignment="Left" Height="7" Margin="4,0,2,0" Stretch="Fill" Visibility="{TemplateBinding StartIndicatorVisibility}" VerticalAlignment="Center" Width="4"/>
                                    <StackPanel Grid.Column="2" Margin="0,3,0,0" VerticalAlignment="Top">
                                        <Image x:Name="RecurrenceMark" Grid.Column="0" HorizontalAlignment="Left" Height="10" Margin="2,1,1,0" Width="10">
                                            <Image.Source>
                                                <BitmapImage UriSource="pack://application:,,,/Telerik.Windows.Controls.ScheduleView;component/Themes/Images/AppointmentException.png"/>
                                            </Image.Source>
                                            <Image.Visibility>
                                                <Binding Path="RecurrenceState">
                                                    <Binding.Converter>
                                                        <telerik:RecurrenceStateIsExeptionToVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </Image.Visibility>
                                        </Image>
                                        <Image x:Name="ExceptionMark" Grid.Column="0" HorizontalAlignment="Left" Height="10" Margin="2,1,1,0" Width="10">
                                            <Image.Source>
                                                <BitmapImage UriSource="pack://application:,,,/Telerik.Windows.Controls.ScheduleView;component/Themes/Images/AppointmentRecurrence.png"/>
                                            </Image.Source>
                                            <Image.Visibility>
                                                <Binding Path="RecurrenceState">
                                                    <Binding.Converter>
                                                        <telerik:RecurrenceStateIsOccurenceToVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </Image.Visibility>
                                        </Image>
                                    </StackPanel>
                                    <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="3" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    <Path Grid.Column="4" Data="M1109.0469,332.70313L1113.0469,336.29663 1109.0469,339.68823z" Fill="Black" HorizontalAlignment="Right" Height="6.984" Margin="2,0,4,0" Stretch="Fill" Visibility="{TemplateBinding EndIndicatorVisibility}" VerticalAlignment="Center" Width="4"/>
                                </Grid>
                                <Grid x:Name="MouseOverOverlay" Opacity="0" Visibility="Collapsed">
                                    <Border x:Name="PART_StartResizeGrip" telerik:DragDropManager.AllowDrag="True" Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Left" VerticalAlignment="Stretch">
                                        <Border.Visibility>
                                            <Binding Path="IsAllDay" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <telerik:InvertedBooleanToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </Border.Visibility>
                                        <StackPanel x:Name="StartResizeGrip" HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center">
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                        </StackPanel>
                                    </Border>
                                    <Border x:Name="PART_EndResizeGrip" telerik:DragDropManager.AllowDrag="True" Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Right" VerticalAlignment="Stretch">
                                        <Border.Visibility>
                                            <Binding Path="IsAllDay" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <telerik:InvertedBooleanToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </Border.Visibility>
                                        <StackPanel x:Name="EndResizeGrip" HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center">
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                            <Border BorderBrush="#FF444444" BorderThickness="0,0,1,1" Background="White" Height="3" Margin="1" Width="3"/>
                                        </StackPanel>
                                    </Border>
                                    <telerik:RadButton x:Name="DeleteButton" ClickMode="Press" CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="telerik:RadScheduleViewCommands.DeleteAppointment" HorizontalAlignment="Right" Height="11" IsTabStop="False" Margin="5,5,6,5" Padding="0" VerticalAlignment="Top" Width="11">
                                        <telerik:StyleManager.Theme>
                                            <telerik:Office_BlackTheme/>
                                        </telerik:StyleManager.Theme>
                                        <telerik:RadButton.Visibility>
                                            <Binding Path="IsEnabled" RelativeSource="{RelativeSource Self}">
                                                <Binding.Converter>
                                                    <telerik:BooleanToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </telerik:RadButton.Visibility>
                                        <Path Data="M0,0L5,5 M5,0L0,5" Stroke="#FF444444"/>
                                    </telerik:RadButton>
                                </Grid>
                            </Grid>
                            <Grid.InputBindings>
                                <MouseBinding MouseAction="LeftDoubleClick" Command="telerik:RadScheduleViewCommands.EditAppointment" />
                            </Grid.InputBindings>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsReadOnly" Value="True"/>
                                    <Condition Property="IsEnabled" Value="True"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Visibility" TargetName="ReadOnlyVisual" Value="Visible"/>
                            </MultiTrigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsReadOnly" Value="False"/>
                                    <Condition Property="IsInInlineEditingMode" Value="False"/>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="IsEnabled" Value="True"/>
                                </MultiTrigger.Conditions>
                                <MultiTrigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0:0:0.4" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverOverlay">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimation BeginTime="0:0:0.2" Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverOverlay"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </MultiTrigger.EnterActions>
                                <MultiTrigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverOverlay">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0.2">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimation BeginTime="0" Duration="0:0:0.2" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverOverlay"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </MultiTrigger.ExitActions>
                                <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible"/>
                                <Setter Property="Visibility" TargetName="MouseOverOverlay" Value="Visible"/>
                            </MultiTrigger>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible"/>
                                <Setter Property="Background" TargetName="CommonStatesVisual" Value="Transparent" />
                                <Setter Property="BorderBrush" TargetName="CommonStatesVisual" Value="Transparent"/>
                                <Setter Property="BorderBrush" TargetName="CommonStatesVisualInnerBorder" Value="Transparent"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Panel.ZIndex" Value="1"/>
        </Style>
    </Style.BasedOn>
</Style>


0
Rosi
Telerik team
answered on 11 Oct 2011, 12:23 PM
Hello Jifong,

To solve the issue I suggest you update the definition of the ContentPresenter like it is shown below:

OLD
                           <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="3" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

NEW

<ContentPresenter   Grid.Column="3"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                           

Kind regards,
Rosi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
JiFong Chen
Top achievements
Rank 1
Answers by
JiFong Chen
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or