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

Problem with groupheaders

1 Answer 95 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Ladislav
Top achievements
Rank 1
Ladislav asked on 26 Nov 2018, 02:31 PM

Hello,

I have problem with displaying group headers after when ever I change date in timeline view. There is xaml for schedule view:

<model:OrientedGroupHeaderContentTemplateSelector x:Key="GroupHeaderContentTemplateSelector">
            <model:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
                <DataTemplate>
                    <Border Background="{Binding Name.Brush}" Width="250" Margin="1 0 1 0">
                        <StackPanel Margin="10 10 10 10" Orientation="Horizontal">
                            <TextBlock Foreground="{StaticResource GroupHeaderForeground}" FontSize="16" Margin="0" Text="{Binding Name.Name}" />
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </model:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
            <model:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
                <DataTemplate>
                    <Border Background="{Binding Name.Brush}" Width="250" Margin="1 0 1 0">
                        <StackPanel Margin="10 10 10 10">
                            <TextBlock Foreground="{StaticResource GroupHeaderForeground}" FontSize="16" Margin="0" Text="{Binding Name.Name}" />
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </model:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
        </model:OrientedGroupHeaderContentTemplateSelector>
 
<LinearGradientBrush x:Key="ReadOnlyBrush" MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="0,0"
                EndPoint="1,1">
            <LinearGradientBrush.Transform>
                <ScaleTransform ScaleX="3" ScaleY="3" />
            </LinearGradientBrush.Transform>
            <GradientStop Offset="0.15" Color="#FF4040C2" />
            <GradientStop Offset="0.15" Color="White" />
        </LinearGradientBrush>
 
        <model:SpecialSlotStyleSelector x:Key="SpecialSlotStyleSelector">
            <model:SpecialSlotStyleSelector.NonWorkingHourStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Canvas.ZIndex" Value="{Binding Slot.ZValueIndex}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Border Background="{StaticResource ReadOnlyBrush}" Opacity="0.7" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </model:SpecialSlotStyleSelector.NonWorkingHourStyle>
        </model:SpecialSlotStyleSelector>
<telerik:RadScheduleView  SpecialSlotsSource="{Binding SpecialSlots}"  GroupDescriptionsSource="{Binding GrpDescriptionCollection,UpdateSourceTrigger=PropertyChanged}" GroupHeaderContentTemplateSelector="{StaticResource GroupHeaderContentTemplateSelector}" ResourceTypesSource="{Binding ResourceTypesCollection, UpdateSourceTrigger=PropertyChanged}" AppointmentsSource="{Binding SeznamOperaciPlan, UpdateSourceTrigger=PropertyChanged}">                       
                        <telerik:RadScheduleView.ViewDefinitions>
                            <telerik:TimelineViewDefinition Orientation="Vertical" TimerulerGroupStringFormat="{}{0:dddd - dd.MM.yyyy}" VisibleDays="6" GroupTickLength="1d" MajorTickLength="1h" MinorTickLength="15min" TimerulerMajorTickStringFormat="{}{0:HH:mm}" TimerulerMinorTickStringFormat=":{0:mm}" StretchAppointments="True" StretchGroupHeaders="False" Title="Timeline"/>
                        </telerik:RadScheduleView.ViewDefinitions>
                    </telerik:RadScheduleView>

GroupDescriptionsSource and ResourceTypesSource are initialized and filled by some data in view model constructor.
On image grupheader-ok.jpg - is all OK and this what I want every when I change date, but if I go to the future date, it displays like on image groupheader-problem.jpg and If I go back to the actual week (current date) then it displays like on image groupheader-problem-back.jpg.

Where could be problem?

Thank you for your answers.

 

 

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 29 Nov 2018, 09:51 AM
Hello Ladislav,

Thank you for the provided files and code snippet.

In order to apply a specific Template for the TimelineViewDefinition inside the SelectTemplate method of your custom OrientedGroupHeaderContentTemplateSelector (named "GroupHeaderContentTemplateSelector") you need to check if the current active ViewDefinition is Timeline and if so to return the desired Template: 
public DataTemplate TimeLineViewTemplate { get; set; }
  
public override DataTemplate SelectTemplate(object item, DependencyObject container, ViewDefinitionBase activeViewDefinition)
{
    if (activeViewDefinition is TimelineViewDefinition)
    {
        return this.TimeLineViewTemplate;
    }
    ...
    return base.SelectTemplate(item, container, activeViewDefinition);
}

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ScheduleView
Asked by
Ladislav
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or