Styling the major and minor ticklines

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    15 posts
    Member since:
    Dec 2014

    Posted 22 Apr 2015 Link to this post

    Hi,

    I'm following along with the tutorial here here, but I'm running into a problem at the end.

    Using the following code from the tutorial I get the error Nested properties are not supported: CustomTimeRulerItemStyleSelector.MajorTickLineStyle

     

    <local:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
        <Style TargetType="scheduleView:TimeRulerLine">
            <Setter Property="BorderBrush" Value="{StaticResource TimeRulerLineStroke}"/>
            <Setter Property="Background" Value="White"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="scheduleView:TimeRulerLine">
                        <Border x:Name="LineVisual" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0 1 0 0" Background="{TemplateBinding Background}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="OrientationStates">
                                    <VisualState x:Name="Horizontal">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderThickness" Storyboard.TargetName="LineVisual">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Thickness>1 0 0 0</Thickness>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Vertical"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </local:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>

    Any ideas on what I'm doing wrong?

    Thanks,
    Jonathan

  2. Nasko
    Admin
    Nasko avatar
    587 posts

    Posted 24 Apr 2015 Link to this post

    Hi Jonathan,

    In order to create a custom TimeRulerItemStyleSelector you need first to declare it in Xaml and then create the MajorTickLineStyle and MinorTickLineStyle as shown below:
    <local:CustomTimeRulerItemStyleSelector x:Key="CustomTimeRulerItemStyleSelector">
        <local:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
            <Style TargetType="telerik:TimeRulerLine">
    ...
            </Style>
        </local:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
    </local:CustomTimeRulerItemStyleSelector>

    Also you could check  this sample project from our SDK Repository that demonstrates how to customize the TimeRulerItemStyleSelector.

    Hopes this helps.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
Back to Top