Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Created Issue: TimelinePanel: BeginDate is set to 31/12/9999 when there are no children present. [19618]

$
0
0
TimelinePanel sets the BeginDate to DateTime.Max when there are no children present. This can be fixed by modifying Size MeasureOverride(Size availableSize) method.

```
protected override Size MeasureOverride( Size availableSize )
{
DateTime calcBeginDate = DateTime.MaxValue; // max value is set
DateTime calcEndDate = DateTime.MinValue;

foreach( UIElement child in InternalChildren ) // if there aren't any children present
{
DateTime date = GetDate( child );
DateTime dateEnd = GetDateEnd( child );

if( date < calcBeginDate )
{
calcBeginDate = date;
}

if( date > calcEndDate )
{
calcEndDate = date;
}

if( dateEnd > calcEndDate )
{
calcEndDate = dateEnd;
}
}

if( BeginDate == DateTime.MinValue ) // this condition is always true the first time control is loaded.
{
BeginDate = calcBeginDate; // if there aren't any children then BeginDate becomes DateTime.Max and stays at that value.
}

```

Viewing all articles
Browse latest Browse all 4964

Trending Articles