Number of items stacked upon each other / overlapping items / required height

2 posts, 0 answers
  1. Johannes
    Johannes avatar
    13 posts
    Member since:
    Mar 2011

    Posted 09 Sep 2012 Link to this post

    Is there any way to determine the number of items that have overlapping timespans and are therefore displayed vertically one below the other? To clarify, I'm interested in the maximum number of items in the whole timeline that are displayed below other items.

    If there are too many items at the same time, the items happen to overlap each other (see attached screenshot, top image). I want to automatically adjust the height of the RadTimeline so that the items don't overlap anymore, but fit in the control without overlapping. (Actually I want to adjust the size of the TimelineItemContainer via a custom style, but what matters is that I get the needed height - the bottom image on the attached screenshot is what I'm trying to achieve with automatical height detection)

    I guess the RadTimeline control knows that height internally anyway, because otherwise it wouldn't know how to layout the overlapping items when there isn't enough space. Is there any way to get the values I'm looking for?
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 13 Sep 2012 Link to this post

    Hello Johannes,

    Basically, in case you want the timeline control to be just as high so that all its items are visible, you can use a small trick to achieve this - simply wrap the timeline in a StackPanel control with vertical orientation. For example:

    <StackPanel Orientation="Vertical">
        <telerik:RadTimeline x:Name="RadTimeline1"
                                PeriodStart="2011/01/01" PeriodEnd="2011/01/10"
                                StartPath="EventStartDate"
                                ItemsSource="{Binding TimelineItems}">
            <telerik:RadTimeline.Intervals>
                <telerik:DayInterval />
                <telerik:WeekInterval />
            </telerik:RadTimeline.Intervals>
        </telerik:RadTimeline>
    </StackPanel>

    On the other hand, in case you really need the number of rows of events in the timeline, you can get this number the following way:
    var rowsCount = this.RadTimeline1.GroupedDataItems.Sum(group => group.DataGroups.Max(subGroup => subGroup.RowsCount));
    Greetings,
    Tsvetie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top