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

Style of TimeRulerGroupItem not being applied after upgrade

10 Answers 118 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 17 Feb 2011, 05:10 PM

Hi, I have the following style set in my global resource dictionary but it is not being applied to the ScheduleView control since I upgraded to the 2010.3.1314.35 binaries. Used to work fine with version 2010.3.1110. Could someone please explain what the cause of this problem might be? I'm using the StringFormat on the binding to output just the day portion of the date but actually the whole date ('17-02-2011') is being output.

<Style x:Key="TimeRulerGroupItemBaseStyle" TargetType="scheduleView:TimeRulerItemBase">
        <Setter Property="Foreground" Value="{StaticResource RadScheduleForeground}" />
        <Setter Property="Background" Value="{StaticResource GroupHeaderHeaderBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource GroupHeaderHeaderOuterBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Padding="0 3" Text="{Binding DateTime, StringFormat='dd'}" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="scheduleView:TimeRulerItemBase">
                    <Grid>
                        <Border x:Name="HeaderVisual" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border BorderBrush="{StaticResource GroupHeaderHeaderInnerBorder}" BorderThickness="1" />
                        </Border>
                        <ContentPresenter Margin="0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

<Style TargetType="scheduleView:TimeRulerGroupItem" BasedOn="{StaticResource TimeRulerGroupItemBaseStyle}" />

Thanks,
Peter.

10 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 22 Feb 2011, 10:50 AM
Hi Peter,

Due to popular demand for date string formatting, since 2010 Q3 SP1 release we have included a TimeRulerItemTemplateSelector in RadScheduleView , which makes the formatting quite easy.
 
You can discard the ContentTemplate set in your style and use the selector instead. You can generate it from Expression Blend or you can find the default xaml for it below. Make your own formatting to the corresponding template in the selector.

<telerik:TimeRulerItemTemplateSelector x:Key="ScheduleViewDataTemplateSelector1">
    <telerik:TimeRulerItemTemplateSelector.HorizontalTimelineMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" TextAlignment="Left" Text="{Binding DateTime, StringFormat=h:mm tt}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.HorizontalTimelineMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalTimelineMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.HorizontalTimelineMinorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalDayMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" Text="{Binding DateTime, StringFormat=h:mm tt}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.HorizontalDayMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalWeekMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" Text="{Binding DateTime, StringFormat=h:mm tt}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.HorizontalWeekMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalWeekMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.HorizontalWeekMinorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalDayMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.HorizontalDayMinorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
        <DataTemplate>
            <TextBlock Margin="2,1" TextAlignment="Left" Text="{Binding DateTime, StringFormat=dd-MM-yyyy}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
    <telerik:TimeRulerItemTemplateSelector.MonthGroupTemplate>
        <DataTemplate>
            <TextBlock Margin="6,2" Text="{Binding DateTime, StringFormat=dddd}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.MonthGroupTemplate>
    <telerik:TimeRulerItemTemplateSelector.MonthItemTemplate>
        <DataTemplate>
            <TextBlock Margin="6,2" Text="{Binding DateTime, StringFormat=dd}"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.MonthItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalTimelineMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" TextAlignment="Right" Text="{Binding DateTime, StringFormat=h:mm tt}" Width="50"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.VerticalTimelineMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalWeekMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.VerticalWeekMinorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalWeekMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" TextAlignment="Right" Text="{Binding DateTime, StringFormat=h:mm tt}" Width="50"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.VerticalWeekMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalTimelineGroupTemplate>
        <DataTemplate>
            <TextBlock Margin="1,2" TextAlignment="Right" Text="{Binding DateTime, StringFormat=dd-MM-yyyy}">
                <TextBlock.LayoutTransform>
                    <RotateTransform Angle="-90"/>
                </TextBlock.LayoutTransform>
            </TextBlock>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.VerticalTimelineGroupTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalDayMajorItemTemplate>
        <DataTemplate>
            <TextBlock Margin="2" TextAlignment="Right" Text="{Binding DateTime, StringFormat=h:mm tt}" Width="50"/>
        </DataTemplate>
    </telerik:TimeRulerItemTemplateSelector.VerticalDayMajorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalDayMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.VerticalDayMinorItemTemplate>
    <telerik:TimeRulerItemTemplateSelector.VerticalTimelineMinorItemTemplate>
        <DataTemplate/>
    </telerik:TimeRulerItemTemplateSelector.VerticalTimelineMinorItemTemplate>
</telerik:TimeRulerItemTemplateSelector>


I hope this will work fine for you.


All the best,
Dani
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Stefan
Top achievements
Rank 1
answered on 08 Sep 2011, 09:23 PM
Hi,

I had (nearly) the same problem since I upgrated from version 2010.3.1314.35 to 2011.2.712.40.
I have a "special" TimeRulerItemTemplateSelector which displays a progressbar (status for each day).
With version 2010.3.1314.35 the value-binding (Value="{Binding DateTime, Converter={StaticResource GetDateValue}}") works fine, version 2011.2.712.40 fired the following error:

TwoWay- oder OneWayToSource-Bindungen funktionieren nicht mit der schreibgeschützten Eigenschaft "DateTime" vom Typ "Telerik.Windows.Controls.ScheduleView.TimerRulerItemProxy".

my sources:

            <telerik:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
                <DataTemplate>
                    <Grid Height="60">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" Text="{Binding DateTime, Converter={StaticResource GetWeekDay}}"/>
                        <TextBlock Grid.Row="1" Text="{Binding DateTime, Converter={StaticResource GetDateShort}}"/>
                        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="2,0,0,0">
                            <ProgressBar Width="40" Minimum="0" Maximum="100" Value="{Binding DateTime, Converter={StaticResource GetDateValue}}"/>
                            <TextBlock Text="{Binding DateTime, Converter={StaticResource GetDateValue}}"/>
                            <TextBlock Text="%"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </telerik:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>

and the GetDateValue Function:

Public Class GetDateValue
    Implements IValueConverter

    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If TypeOf value Is DateTime Then
            Dim dt As DateTime = DirectCast(value, DateTime)
            value = 50   'only for demo...
        End If
        Return value

    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotImplementedException()
    End Function

End Class

with best regards,
Stefan

0
Dani
Telerik team
answered on 12 Sep 2011, 10:07 AM
Hi Stefan,

I used your feedback and code to try and reproduce the issue, but with no success.

I attach here a rough project which was tested both with 0712 assemblies and with 0823 assemblies, the later being our latest LIB. I would appreciate it if you help us reproduce the issue.


Kind regards,
Dani
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Stefan
Top achievements
Rank 1
answered on 12 Sep 2011, 10:34 AM
Hi Dani,

Sorry I can´t test your sample because I have only installed the WPF-Controls.
Please send me the WPF-Version and I will test it on my system and give you feedback as soon as possible.

Thanks.

kind regards,
Stefan
0
Stefan
Top achievements
Rank 1
answered on 13 Sep 2011, 12:47 PM
Hi Dani,

It is very easy for me to reproduce the error.
I did the following steps:
 
1. Create a new project  => it works (Version 2010.3.1314.35)
2. Upgrade all Telerik-components by using the Upgrade wizard (Visual Studio Add-In). (New Version: RadControls_for_WPF40_2011_2_0712_Trial_hotfix, 2011.2.712.40)
3. After the uprgrade the error is replicable, the "old" project is still running!
 
Give me an emali-adress and I will send you both projects (before / after upgrade).
 
Kindly regards,
Stefan
 
P.S.: I´m a freelancer and my customers (Codex GmbH  and Annexus mobile (APM Group)) have licences for Telerik RadControls.


0
Dani
Telerik team
answered on 16 Sep 2011, 01:44 PM
Hello Stefan,

First of all, please accept our apologies for the delayed answer. We are a bit busier than usual with latest fixes for the SP1 release next week.

Thank you for the explanational notes. I was able to reproduce the issue with a WPF project. It turns out the DateTime property on TimeRulerItemProxy is indeed read-only by design. You can use it in OneWay DataBindings , but you cannot change it.

So, what you can do at this stage is add a OneWay mode to the binding you use:

<ProgressBar Width="40" Minimum="0" Maximum="100" Value="{Binding DateTime, Converter={StaticResource GetDateValue}, Mode=OneWay}"/>

I hope this will be helpful.


All the best,
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 16 Sep 2011, 02:26 PM
Hello Dani,

For your information. The problem is only with version: 2011.2.712.40.
Yesterday i changed the project-references back to version 2010.30.1314.35 and everything works fine.
A further case with "GroupHeaderContentTemplateSelector" was also ok with 2010.30.1314.35, but not with 2011.2.712.40.
The downgrade to 2010.x also solves this problem without any changes inside my code.


My Code:
            <telerik:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
                <DataTemplate>
                    <Grid Height="45" Width="150" Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="15"/>
                            <RowDefinition Height="15"/>
                            <RowDefinition Height="15"/>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" Text="{Binding Name.DisplayName}" Foreground="Red"/>
                        <TextBlock Grid.Row="1" Text="{Binding Name.PrjBez}" Foreground="Navy"/>
                        <TextBlock Grid.Row="2" Text="{Binding Name.Kunde}" Foreground="Green"/>
                    </Grid>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>


Have a good time,
Stefan

0
Pana
Telerik team
answered on 21 Sep 2011, 02:11 PM
Hi Stefan,

I am sorry for the inconvenience but I did not understood. Have the OneWay option fixed the issue or you are still experiencing problems?

Kind regards,
Pana
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 21 Sep 2011, 02:22 PM
Hi Pana,

Thanks yor your feedback.
At the moment I´m  still working with 2010.30.1314.35. The error occured only with version 2011.2.712.40.
I will upgrade at a later time and I will give you feedback.

kind regards,
Stefan
0
Pana
Telerik team
answered on 21 Sep 2011, 02:38 PM
Ok
Tags
ScheduleView
Asked by
Peter
Top achievements
Rank 1
Answers by
Dani
Telerik team
Stefan
Top achievements
Rank 1
Pana
Telerik team
Share this question
or