Timeline SelectionMode with custom templates

3 posts, 1 answers
  1. Chris
    Chris avatar
    7 posts
    Member since:
    Feb 2015

    Posted 09 Mar 2015 Link to this post

    Hi,

    Is is possible to have fully customised templates that still supports the SelectionMode functionality?

    I have a Timeline supporting Selection (SelectionMode="Extended") working as expected.  However, as soon as I change the item template using TimelineItemTemplate to contain some custom content it no longer allows selections to be made.

    E.g. using the Telerik demo code template from the CustomizingItems project shows the issue:

    <DataTemplate x:Key="ItemWithDurationTemplate">
            <Border Width="10" Height="10" ...>
                <Rectangle Height="7" Width="7"  ... >
                </Rectangle>
            </Border>
        </DataTemplate>
     
    ...
     
    <t:RadTimeline Grid.Row="0"
        TimelineItemTemplate="{StaticResource ItemWithDurationTemplate}"
     
    ...


    If I change the template to:

    <DataTemplate x:Key="ItemWithDurationTemplate">
        <t:TimelineItemControl x:Name="ItemLine" Height="10" ... />
     
    ...


    it again allows selection.  It appears that the selection feature is provided by the Telerik control TimelineItemControl.  However this doesn't allow content and so limits customisability.

    Thanks,
    Chris


  2. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 10 Mar 2015 Link to this post

    Hello Chris,

    Unfortunately this is a known limitation of the control, which is already logged in our feedback portal (the same behavior is observed in WPF also). I can suggest you two solutions.

    The first one is to use implicit style instead of data template, the same as CustomTimelineItemControlStyle in the attached project, just remove the key.

    If a data template is needed for your requirements, you can put a TimelineItemControl inside it and apply to it the needed custom style (with the visual states since they are needed to achieve a visual presentation of the selection).

    A similar approach is used in our FirstLook demo (again the same is available for WPF).

    Please let me know whether this helps.

    Regards,
    Sia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Chris
    Chris avatar
    7 posts
    Member since:
    Feb 2015

    Posted 10 Mar 2015 in reply to Sia Link to this post

    Hi Sia,

    I hadn't spotted that post.  Both the solutions you have proposed would work and thanks for the quick reply :-)

    Chris
Back to Top