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

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

1 Answer 132 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Johannes
Top achievements
Rank 1
Johannes asked on 09 Sep 2012, 09:40 PM
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?

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 13 Sep 2012, 08:29 AM
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.

Tags
TimeLine
Asked by
Johannes
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or