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

backgroundcolor in timeline-view

8 Answers 316 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Stefan asked on 05 Oct 2011, 06:31 PM
Hi,

Is it possible to change the background color for special weekdays (for example saturday and sunday) in timeline-view-modus?
Or (as alternative) is it possible to change the column width or visibility for special weekdays. In my scenario I must differentiate between working days and weekend days.

Thanks in advance,

Best regards,
Stefan

8 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 06 Oct 2011, 08:48 AM
Hello Stefan,

RadScheduleView has a convenient feature which you can use to differentiate between slots - the SpecialSlotStyleSelector. Please, check this online help article for more details.

I hope this solution will fit well in your scenario.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Stefan
Top achievements
Rank 1
answered on 06 Oct 2011, 02:06 PM
Hi Dani,

Thank´s for your feedback. The sample (http://www.telerik.com/help/wpf/radscheduleview-features-speacialslots.html#specialslots) seems to be very simple. I translate the (same) code to VB.NET, but in it doesn´t work. Sorry, but I can´t find a solution.
Please have a look to my code. Can you see a difference?

Thank you in advance.
Regards,
Stefan

1. XAML
<Window x:Class="Test"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:local="clr-namespace:WinBZP"
    Title="Test" Height="400" Width="600">

    <Window.Resources>
        <local:SpecialSlotStyleSelector x:Key="SpecialSlotStyleSelector">
            <local:SpecialSlotStyleSelector.NonworkingHourStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Border Background="Yellow"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </local:SpecialSlotStyleSelector.NonworkingHourStyle>
        </local:SpecialSlotStyleSelector>
    </Window.Resources>
    <Grid>
        <telerik:RadScheduleView Margin="5" x:Name="radschedTest"
            SpecialSlotsSource="{Binding NonWorkingHours}"
            SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}"
            AppointmentsSource="{Binding Appointments}">
            <telerik:RadScheduleView.ViewDefinitions>
                <telerik:WeekViewDefinition/>
            </telerik:RadScheduleView.ViewDefinitions>
        </telerik:RadScheduleView>
    </Grid>
</Window>

2. Code behind:
Imports Telerik.Windows.Controls
Imports System.Collections.ObjectModel
Imports Telerik.Windows.Controls.ScheduleView

Public Class Test

    Public Sub New()
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
        'Create the collection of Slot objects and set their RecurrencePattern property...
        CreateSlotCollection()
        'Set the DataContext
        Me.radschedTest.DataContext = New ScheduleViewModelBauphasen
    End Sub

    Private Sub CreateSlotCollection()

        Dim NonWorkingHours = New ObservableCollection(Of Slot)()
        Dim datStart As DateTime = New DateTime(2010, 1, 1, 8, 0, 0)
        Dim datEnd As DateTime = New DateTime(2010, 1, 1, 18, 0, 0)

        NonWorkingHours.Add(New Slot(datEnd, datStart.AddDays(1)) With { _
         .RecurrencePattern = New RecurrencePattern(Nothing, RecurrenceDays.Monday Or RecurrenceDays.Tuesday Or RecurrenceDays.Wednesday Or RecurrenceDays.Thursday, RecurrenceFrequency.Weekly, 1, Nothing, Nothing)})

        NonWorkingHours.Add(New Slot(datEnd, datStart.AddDays(3)) With { _
         .RecurrencePattern = New RecurrencePattern(Nothing, RecurrenceDays.Friday, RecurrenceFrequency.Weekly, 1, Nothing, Nothing)})

    End Sub

End Class

Public Class SpecialSlotStyleSelector

    Inherits ScheduleViewStyleSelector
    Private m_nonworkingHourStyle As Style

    Public Property NonworkingHourStyle() As Style
        Get
            Return Me.m_nonworkingHourStyle
        End Get
        Set(ByVal value As Style)
            Me.m_nonworkingHourStyle = value
        End Set
    End Property

    Public Overrides Function SelectStyle(ByVal item As Object, ByVal container As DependencyObject, ByVal activeViewDefinition As ViewDefinitionBase) As Style
        Return Me.NonworkingHourStyle
    End Function

End Class

3. the result (????)

0
Dani
Telerik team
answered on 11 Oct 2011, 10:02 AM
Hello Stefan,

I am afraid the image is missing.

I can see that you are using the online example related to Special and Read-only slots in RadScheduleView. I attach here a wokring copy of the example in VB. Please, use it as a reference and let me know if you need further help on this issue.

I hope this helps.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Aug 2013, 08:10 AM
Hi Telerik Team,

After a lot of trial and error, I figured out that theming overwrites the specified styling. Is there anyway to prevent this other than customizing the theme?
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 11 Aug 2013, 06:07 PM
Telerik Team,

I though I had this fixed when I removed theming form the application as it worked as expected. However after playing with some other elements (trying out the QueryableDomainServiceCollectionView) it suddenly no longer works even with no theming.The special slots are created as I have made them read-only and cannot edit appointments at run time due to them. However the background color does not change as expected.

<UserControl.Resources>
    <DataTemplate x:Key="AppointmentTooltip" DataType="local:VesselAppointment">
        <TextBlock Text="{Binding Body}" />
    </DataTemplate>
 
    <local:SpecialSlotStyleSelector x:Key="SpecialSlotStyleSelector">
        <local:SpecialSlotStyleSelector.NonworkingHourStyle>
            <Style TargetType="scheduleView:HighlightItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Border Background="CornflowerBlue"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </local:SpecialSlotStyleSelector.NonworkingHourStyle>
    </local:SpecialSlotStyleSelector>
</UserControl.Resources>
 
<Grid x:Name="LayoutRoot" Background="White">
    <Grid.RowDefinitions>
        <RowDefinition Height="30" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
     
    <telerik:RadButton Grid.Row="0"
                       Content="Refresh"
                       Command="{Binding cmdRefreshVesselList}"/>
 
    <Grid Grid.Row="1" >
        <Grid.RowDefinitions>
            <RowDefinition Height="50*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="50*"/>
        </Grid.RowDefinitions>
 
        <telerik:RadBusyIndicator Grid.Row="0" IsBusy="{Binding Path=VesselSchedule.IsBusy}" >
            <telerik:RadScheduleView MaxTimeRulerExtent="30400"
                                     ToolTipTemplate="{StaticResource AppointmentTooltip}"
                                     AppointmentsSource="{Binding VesselSchedule}"
                                     SpecialSlotsSource="{Binding PortShutPeriods}"
                                     SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}">
 
                <telerik:RadScheduleView.ResourceTypesSource>
                    <scheduleView:ResourceTypeCollection>
                        <scheduleView:ResourceType Name="PlanningStatus" DisplayName="Status">
                            <scheduleView:Resource ResourceName="Scheduled" />
                            <scheduleView:Resource ResourceName="Planned" />
                        </scheduleView:ResourceType>
                    </scheduleView:ResourceTypeCollection>
                </telerik:RadScheduleView.ResourceTypesSource>
 
                <telerik:RadScheduleView.GroupDescriptionsSource>
                    <telerik:GroupDescriptionCollection>
                        <telerik:ResourceGroupDescription ResourceType="PlanningStatus" />
                    </telerik:GroupDescriptionCollection>
                </telerik:RadScheduleView.GroupDescriptionsSource>
 
                <telerik:RadScheduleView.ViewDefinitions >
                    <!--<telerik:WeekViewDefinition />
                    <telerik:MonthViewDefinition />-->
                    <telerik:TimelineViewDefinition VisibleDays="42"
                                                    ShowTimeRuler="True"
                                                    GroupTickLength="1m"
                                                    TimerulerGroupStringFormat="{}{0:MMMM yyyy}"
                                                    MajorTickLength="1w"
                                                    TimerulerMajorTickStringFormat="{}{0:dd/MM/yy}"
                                                    StretchAppointments="False"
                                                    StretchGroupHeaders="True" />
                </telerik:RadScheduleView.ViewDefinitions>
            </telerik:RadScheduleView>
        </telerik:RadBusyIndicator>

Your urgent assistance will be greatly appreciated.

Renier
0
Yana
Telerik team
answered on 12 Aug 2013, 08:44 AM
Hi Renier,

The provided code seems correct and we cannot find in it a reason for the issue you're experiencing. Can you please send us a simple runnable project where the problem can be reproduced? You should open a support ticket and attach it there.

Thanks in advance.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 Aug 2013, 11:50 AM
Hi Yana,

I have stripped the functionality out to a test solution for upload. In that I managed to identify were things go wrong. I group appointments by resource. If I comment out GroupDescriptionsSource section then the style is applied as expected. Uncomment it and style is not applied. I am a Silverlight novice so I might be missing something obvious.

Will wait for your response before I create the support ticket in case it is something trivial.

Regards

Renier
0
Yana
Telerik team
answered on 14 Aug 2013, 07:48 AM
Hi Renier,

You should add the needed Resources to the SpecialSlots as well ( I mean to their Resources collection), please check the following article where the approach is demonstrated:
http://www.telerik.com/help/wpf/radscheduleview-features-speacialslots.html#readonlyslots

I hope this helps. If you still experience the issue, please send us the stripped project, so we to be able to assist further.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
Stefan
Top achievements
Rank 1
Answers by
Dani
Telerik team
Stefan
Top achievements
Rank 1
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Yana
Telerik team
Share this question
or