Rendering problems on VisibleRangeChanged

0 Answers 43 Views
ScheduleView
Ola
Top achievements
Rank 1
Ola asked on 22 Sep 2023, 12:17 PM

Hi

I have a problem with rendering of the ScheduleView when I change VisibleRange. I use a WeekViewDefinition with a Horizontal orientation. In the handler of the VisibleRangeChangedCommand I replace the content of the binding source of the AppointmentsSource property. When I switch to a new week the new Appointments are not rendered correctly (see screenshot). When I resize my dialog containing the ScheduleView the ScheduleView is updated and rendered correctly.

I started to get this problem when I set the MinTimeRulerExtent property, so that I do not get a scrollbar on my ScheduleView. I guess applying the scrollbar forces an update of the ScheduleView.

Is there a way to force an update after the VisibleRangeChanged event to get the proper rendering?

I use the Windows8 theme and 2021.1.119 version of Telerik WPF components.

Here is the definition of my ScheduleView:

 

<UserControl
    x:Class="Tennotech.Hilding.Watchman.Presentation.Views.Schedules.ScheduleExceptionsDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:schedules="clr-namespace:Tennotech.Hilding.Watchman.Presentation.Views.Schedules"
    xmlns:dt="http://tennotech.com/desktop/xaml/2014"
    xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ScheduleResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            
            <telerik:OrientedAppointmentItemStyleSelector x:Key="AppointmentItemStyleSelector"> 
                <telerik:OrientedAppointmentItemStyleSelector.MonthViewStyle> 
                    <Style TargetType="telerik:AppointmentItem" BasedOn="{StaticResource AppointmentItemBaseStyle}"> 
                        <Setter Property="Margin" Value="2 1 2 0" /> 
                        <Setter Property="Background" Value="DarkSlateGray" />
                        <Setter Property="ToolTip" Value="{Binding Appointment.ToolTip}" />
                    </Style> 
                </telerik:OrientedAppointmentItemStyleSelector.MonthViewStyle> 

                <!-- This is the style used by schedules -->
                <telerik:OrientedAppointmentItemStyleSelector.HorizontalStyle> 
                    <Style TargetType="telerik:AppointmentItem" BasedOn="{StaticResource AppointmentItemBaseStyle}">
                        <Setter Property="Margin" Value="0 2 0 10" /> 
                        <Setter Property="Background" Value="#324245" /> 
                        <Setter Property="ToolTip" Value="{Binding Appointment.ToolTip}" />
                    </Style> 
                </telerik:OrientedAppointmentItemStyleSelector.HorizontalStyle>
                
                <telerik:OrientedAppointmentItemStyleSelector.VerticalStyle> 
                    <Style TargetType="telerik:AppointmentItem" BasedOn="{StaticResource AppointmentItemBaseStyle}"> 
                        <Setter Property="Template" Value="{StaticResource AppointmentItemVerticalControlTemplate}"/> 
                        <Setter Property="ResizeCursor" Value="SizeNS"></Setter> 
                        <Setter Property="Margin" Value="1 5 0 5" />
                        <Setter Property="Background" Value="Pink" /> 
                        <Setter Property="ToolTip" Value="{Binding Appointment.ToolTip}" />
                    </Style> 
                </telerik:OrientedAppointmentItemStyleSelector.VerticalStyle> 
            </telerik:OrientedAppointmentItemStyleSelector> 
            
            <DataTemplate x:Key="ToolTipTemplate"> 
                <Grid> 
                    <StackPanel> 
                        <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> 
                            <TextBlock Text="{Binding Start, StringFormat='hh:mm tt'}" TextWrapping="Wrap" FontSize="12" /> 
                            <TextBlock Text=" - " FontSize="10" /> 
                            <TextBlock Text="{Binding End, StringFormat='hh:mm tt'}" TextWrapping="Wrap" FontSize="12" /> 
                        </StackPanel> 
                        <TextBlock Text="{Binding Start, StringFormat='dddd dd MMM yyyy'}" Margin="0 3" FontSize="12" /> 
                    </StackPanel> 
                </Grid> 
            </DataTemplate>
            
            <schedules:ScheduleSlotStyleSelector x:Key="SpecialSlotStyleSelector"> 
                <schedules:ScheduleSlotStyleSelector.ScheduleStyle> 
                    <Style TargetType="telerik:HighlightItem">
                         
                        <Setter Property="Template"> 
                            <Setter.Value> 
                                <ControlTemplate>
                                    <Grid Margin="-2 1 -2 1">
                                        <Border Background="Black"/>
                                        <Border BorderBrush="Gray" BorderThickness="1"/> 
                                    </Grid> 
                                </ControlTemplate> 
                            </Setter.Value> 
                        </Setter> 
                    </Style> 
                </schedules:ScheduleSlotStyleSelector.ScheduleStyle>
                
                <schedules:ScheduleSlotStyleSelector.HistoricStyle> 
                    <Style TargetType="telerik:HighlightItem">
                         
                        <Setter Property="Template"> 
                            <Setter.Value> 
                                <ControlTemplate>
                                    <Grid Margin="-2 1 -2 1">
                                        <Border Background="Transparent"/>
                                        <Border BorderBrush="Gray" BorderThickness="1"/> 
                                    </Grid> 
                                </ControlTemplate> 
                            </Setter.Value> 
                        </Setter> 
                    </Style> 
                </schedules:ScheduleSlotStyleSelector.HistoricStyle> 

            </schedules:ScheduleSlotStyleSelector> 
            
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <!--
        SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}"
        MouseOverHighlightStyle="{StaticResource MouseOverHighlightStyle}"
        SelectionHighlightStyle="{StaticResource SelectionHighlightStyle}"
        -->
        
        <telerik:RadScheduleView
            x:Name="ScheduleView"
            AppointmentsSource="{Binding Appointments}"
            VisibleRangeChangedCommand="{Binding VisibleRangeChangedCommand}"
            VisibleRangeChangedCommandParameter="{Binding VisibleRange, RelativeSource={RelativeSource Self}}"
            CurrentDate="{Binding CurrentDate, Mode=TwoWay}"
            SnapAppointments="True"
            TodayButtonVisibility="Hidden"
            IsInlineEditingEnabled="False"
            NavigationHeaderVisibility="Visible"
            SpecialSlotsSource="{Binding SpecialSlots}"
            FirstVisibleTime="0:00"
            ResourceTypesSource="{Binding ResourceTypes}"
            AppointmentStyleSelector="{StaticResource AppointmentItemStyleSelector}"
            GroupHeaderStyleSelector="{StaticResource SchemaGroupHeaderStyleSelector}"
            GroupHeaderContentTemplateSelector="{StaticResource SchemaGroupHeaderContentTemplateSelector}"
            ToolTipTemplate="{StaticResource ToolTipTemplate}"
            SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}"
            MinTimeRulerExtent="200"
            >
            <!--
            MinTimeRulerExtent="200"
             -->
            
            <b:Interaction.Behaviors>
                <schedules:PreventCloseDialogBehavior/>
                <schedules:PreventAddScheduleDialogException/>
                <schedules:FastAppointmentAddBehavior Appointments="{Binding Appointments}"/>
                <schedules:FilterAppointmentsBehavior/>
            </b:Interaction.Behaviors>
            
            <telerik:RadScheduleView.DragDropBehavior> 
                <schedules:ScheduleDragDropBehavior />
            </telerik:RadScheduleView.DragDropBehavior>
            <telerik:RadScheduleView.SlotSelectionBehavior> 
                <schedules:ScheduleSlotSelectionBehavior/> 
            </telerik:RadScheduleView.SlotSelectionBehavior> 

            <telerik:RadScheduleView.ActiveViewDefinition>
                <telerik:WeekViewDefinition
                    TimerulerMajorTickStringFormat="{}{0:%H}:{0:mm}"
                    ShowWeekGroupHeaders="False"
                    MinorTickLength="15min"
                    Orientation="Horizontal"
                    StretchGroupHeaders="True"
                    FirstDayOfWeek="Monday"
                    VisibleDays="7" />
                
            </telerik:RadScheduleView.ActiveViewDefinition>

            <telerik:RadScheduleView.GroupDescriptionsSource>
                <telerik:GroupDescriptionCollection>
                    <telerik:DateGroupDescription/>
                    <telerik:ResourceGroupDescription ResourceType="Schedules" />
                </telerik:GroupDescriptionCollection>
            </telerik:RadScheduleView.GroupDescriptionsSource>
        </telerik:RadScheduleView>
        
        <DockPanel Grid.Column="1" Margin="20 0 0 0" MinWidth="300">
            <TextBlock Text="{dt:Text ScheduleExceptions}" DockPanel.Dock="Top" Style="{StaticResource Title}"/>

            <telerik:RadGridView
                x:Name="ScheduleGrid"
                DockPanel.Dock="Bottom"
                ItemsSource="{Binding ScheduleExceptions}"
                AutoExpandGroups="True"
                AutoGenerateColumns="False"
                CanUserFreezeColumns="False"
                CanUserReorderColumns="False"
                CanUserSelect="True"
                EnableRowVirtualization="True"
                GroupRenderMode="Flat"
                IsReadOnly="True"
                RowIndicatorVisibility="Collapsed"
                SelectionMode="Single"
                SelectionUnit="FullRow"
                ShowGroupPanel="False"
                dt:CommandBindingsBehavior.RegisterCommandBindings="{Binding CommandBindings}">
                
                <b:Interaction.Behaviors>
                    <schedules:RowDoubleClickBehavior Command="{Binding RowDoubleClickedCommand}"/>
                </b:Interaction.Behaviors>
                
                <!--
                <b:Interaction.Triggers>
                    <b:EventTrigger EventName="RowActivated" >
                        <b:InvokeCommandAction Command="{Binding RowActivatedCommand}" />
                    </b:EventTrigger>
                </b:Interaction.Triggers>
                -->
                
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn
                        SortingState="Ascending"
                        DataMemberBinding="{Binding Start}"
                        Header="{dt:Text Start}" />
                    
                    <telerik:GridViewDataColumn
                        IsSortable="False"
                        DataMemberBinding="{Binding End}"
                        Header="{dt:Text End}" />
                    
                    <telerik:GridViewDataColumn
                        IsSortable="False"
                        DataMemberBinding="{Binding IsActive}"
                        Header="{dt:Text IsActive}" />
                    
                    <telerik:GridViewColumn
                        Header="Delete"
                        IsSortable="False"> 
                        <telerik:GridViewColumn.CellTemplate> 
                            <DataTemplate> 
                                <telerik:RadButton
                                    Content="Delete"
                                    Command="telerik:RadGridViewCommands.Delete"
                                    CommandParameter="{Binding}" /> 
                            </DataTemplate> 
                        </telerik:GridViewColumn.CellTemplate> 
                    </telerik:GridViewColumn> 
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </DockPanel>
        
    </Grid>
</UserControl>

Stenly
Telerik team
commented on 27 Sep 2023, 12:02 PM

Is the observed behavior reproducible with the latest version of our assemblies, which is 2023.2.718? If it's still present, could you isolate the unwanted behavior in a sample project that I could test?
Ola
Top achievements
Rank 1
commented on 21 Nov 2023, 02:38 PM

I updated the assemblies to the latest version and can see att the problem has been fixed. Thank you.

/Ola

Stenly
Telerik team
commented on 21 Nov 2023, 02:57 PM

Thank you for your feedback. I am happy to hear that the update has fixed the unwanted behavior.

No answers yet. Maybe you can help?

Tags
ScheduleView
Asked by
Ola
Top achievements
Rank 1
Share this question
or