Goober
Goober

Reputation: 13506

C# Silverlight - Building a Timeline?

Does anyone have any good pointers for creating a custom silverlight timeline?! In fact it doesn't even need to be that custom, I have a database table and each object in that table has a datetime field called "CreateDate". I want to use this field to assemble a timeline, showing the other relevant fields at each specific CreateDate point........

Any tips? advice? help? samples?

Cheers

Upvotes: 1

Views: 4143

Answers (3)

s.vista
s.vista

Reputation: 11

Try this one also timeline.codeplex.com. It is free control under LGPL license.

Upvotes: 1

markti
markti

Reputation: 4526

Implement your own Timeline Panel. Its quite easy!

Panels allow you to control layout generically for its children. The ItemsControl for example exposes a property called ItemsPanel that is of type ItemsPanelTemplate. By default this ItemsPanelTemplate contains a vertical StackPanel but can be overridden with your awesome Timeline Panel. They key to any timeline is the x-coordinate.

Using the code below to calculate your x coordinate is half the battle. After that its just a matter of determining overlap so you can properly stack your items on the timeline.

The Avanade Silverlight Accelerator has both a Timeline Control and a StackCalendar Control (think Gannt Chart) which work very nicely.

public double ScaleDate(DateTime date)
    {
        TimeSpan span = this.StopDate - this.StartDate;
        TimeSpan pos = date - this.StartDate;

        double posDays = double.Parse(pos.Days.ToString());
        double spanDays = double.Parse(span.Days.ToString());
        double x = posDays / spanDays;

        return x;
    }

Upvotes: 2

Magnus Johansson
Magnus Johansson

Reputation: 28325

The only one that I know of is this commercial control from Infragistics.

(I am not affiliated with them)

Upvotes: 1

Related Questions