Write data into a row programmically

Mar 12, 2010 at 4:09 PM

Hi,

I was trying to create a TimelineEvent which have the properties and row set. After that I wanted to show the Timeline with the event, but the TimelineEvent wasnt shown. Could anyone please help me, because you cant find any helpful documentation in the internet or in this blog.

Here is the code:

MainPage.xaml

 

 

<Grid x:Name="grdTimeLine">

 

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

 

<Grid.RowDefinitions><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<RowDefinition Height="*" /><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<RowDefinition Height="30" /><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

</Grid.RowDefinitions>

 

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<timeline:TimelineTray<font size="2">

 

</font>

 

x:Name="timeline"<font size="2">

 

</font>

 

Grid.Row="0"

CultureID="de-DE"<font size="2">

 

</font>

 

CalendarType="gregorian"

HorizontalAlignment="Stretch">

 

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<Grid.RowDefinitions><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<RowDefinition Height="*" /><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<RowDefinition Height="50" /><font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<RowDefinition Height="50" />

</Grid.RowDefinitions>

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<timeline:TimelineBand

Grid.Row="0"

IsMainBand="True"

ItemSourceType="days"

HorizontalAlignment="Stretch"

TimelineWindowSize="50"

MaxEventHeight="130" />

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

 

 

<timeline:TimelineBand<font size="2">

 

</font>

 

Grid.Row="1"<font size="2">

 

</font>

 

HorizontalAlignment="Stretch"<font size="2">

 

</font>

 

ItemSourceType="months"<font size="2">

 

</font>

 

TimelineWindowSize="12"<font size="2">

 

</font>

 

MaxEventHeight="4" />

 

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

 

<timeline:TimelineBand<font size="2">

 

</font>

 

Grid.Row="2"<font size="2">

 

</font>

 

HorizontalAlignment="Stretch"<font size="2">

 

</font>

 

ItemSourceType="years"<font size="2">

 

</font>

 

TimelineWindowSize="2"<font size="2">

 

</font>

 

MaxEventHeight="4" />

</timeline:TimelineTray>

 </Grid>

 

 

MainPage.xaml.cs

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

public

</font></font><font size="2" color="#0000ff">

 

</font>

MainPage()

{

InitializeComponent();

<font size="2">

 

</font>

DateTime dateNow = DateTime.Now;<font size="2">

timeline.MinDateTime =

</font>

new DateTime(dateNow.Year - 1, dateNow.Month, dateNow.Day);<font size="2">

timeline.MaxDateTime =

</font>

new DateTime(dateNow.Year + 2, dateNow.Month, dateNow.Day);

timeline.InitialDateTime = dateNow.AddDays(15);

 

<font size="2">

timeline.TimelineReady +=

</font>

new EventHandler(timeline_TimelineReady);

}

 

 <font size="2" color="#0000ff"><font size="2" color="#0000ff">

private

</font></font><font size="2" color="#0000ff">

 

</font>

void timeline_TimelineReady(object sender, EventArgs e)

{

<font size="2">

TimelineLibrary.

</font>

TimelineEvent timelineEvent = new TimelineEvent();<font size="2">

timelineEvent.Title =

</font>

"testoutput";<font size="2">

timelineEvent.StartDate =

</font>

new DateTime(2010, 03, 01);<font size="2">

timelineEvent.StartDate =

</font>

new DateTime(2010, 03, 30);<font size="2">

timelineEvent.Description =

</font>

"description";<font size="2">

timelineEvent.EventColor =

</font>

"blue";<font size="2">

timelineEvent.EventImage =

</font>

"";<font size="2">

timelineEvent.Id =

</font>

"999";<font size="2">

timelineEvent.IsDuration =

</font>

true;<font size="2">

timelineEvent.Link =

</font>

"";<font size="2">

timelineEvent.TeaserEventImage =

</font>

"";

timelineEvent.RowOverride = 1;

timelineEvent.Row = 1;

<font size="2">

 

</font>

TimelineDisplayEvent timelineDisplayEvent = new TimelineDisplayEvent(timelineEvent);

timelineDisplayEvent.ActualEventPixelWidth = 50;

timelineDisplayEvent.FixDescription(timelineEvent.Description);

timelineDisplayEvent.EventPixelWidth = 30;

<font size="2">

timelineDisplayEvent.Teaser =

</font>

"";

timelineDisplayEvent.Top = 200;

<font size="2">

timelineDisplayEvent.EventColorBrush = (

</font>

Brush)(new SolidColorBrush(Colors.Blue));<font size="2">

 

</font>

// Shows the right output (testoutput)

<font size="2">

 

</font>

 

MessageBox.Show(timelineDisplayEvent.Title);

}

 

Thanks,

Alex