RadScheduleView TimeRuler command

1 posts, 0 answers
  1. Johann
    Johann avatar
    1 posts
    Member since:
    Nov 2016

    Posted 30 Nov 2016 Link to this post

    Hi,

    I use the RadScheduleView and I try to add an command to the TimeRuler line (on each date). I implement custom TimeRulerItemTemplateSelector like this : 

    TimeRulerItemTemplateSelector="{StaticResource CustomTimeRulerItemTemplateSelector}"

     

    In this template, I use the HorizontalTimelineGroupTemplate with an TextBlock to format the text. This works great. I want to add an command to this TextBlock (or a button), but the command is never raised.

    I have try with the InputBinding :

    <selectors:CustomTimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
        <DataTemplate>
            <TextBlock  TextAlignment="Left" Padding="2,0">
                <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource DateToStringFormatConverter}">
                        <Binding Path="DateTime" />
                        <Binding Path="DataContext.PlanningHelper.GroupHeaderStringFormat" RelativeSource="{RelativeSource AncestorType={x:Type ucPlanning1:PlanningList}}" />
                    </MultiBinding>
                </TextBlock.Text>
                <TextBlock.InputBindings>
                    <MouseBinding Command="{Binding DataContext.TestCommand, RelativeSource={RelativeSource AncestorType={x:Type ucPlanning1:PlanningList}}}" MouseAction="LeftClick" />
                </TextBlock.InputBindings>
            </TextBlock>
        </DataTemplate>
    </selectors:CustomTimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>

     

    And with telerik:EventToCommandBehavior.EventBindings :

    <selectors:CustomTimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>
        <DataTemplate>
            <TextBlock  TextAlignment="Left" Padding="2,0">
                <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource DateToStringFormatConverter}">
                        <Binding Path="DateTime" />
                        <Binding Path="DataContext.PlanningHelper.GroupHeaderStringFormat" RelativeSource="{RelativeSource AncestorType={x:Type ucPlanning1:PlanningList}}" />
                    </MultiBinding>
                </TextBlock.Text>
                <telerik:EventToCommandBehavior.EventBindings>
                    <telerik:EventBinding Command="{Binding DataContext.TestCommand, RelativeSource={RelativeSource AncestorType={x:Type ucPlanning1:PlanningList}}}" EventName="MouseEnter" />
                </telerik:EventToCommandBehavior.EventBindings>
            </TextBlock>
        </DataTemplate>
    </selectors:CustomTimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate>

     

    But my TestCommand is never call.

    What's wrong with my code? How to implement command inside the TimeRuler?

    Thanks for your help.

Back to Top