I've been able to solve the problem, which occurred when I was dynamically adding time periods to a timeline.
The controls I'm dynamically adding, to a canvas, have the following structure.
<Path x:Name="ribbonItem" Fill="Green">
<Path.Data>
<GeometryGroup>
<RectangleGeometry x:Name="ribbonItemBackground" />
</GeometryGroup>
</Path.Data>
</Path>
The dimensions of the RectangleGeometry depend on three inputs, the date and time ranges of the timeline bar and timeline item (what I'm adding) and the dimensions of the bar (canvas).
The following method is called when any of the BarRange, ItemRange or BarSize properties of the object are set.
private void Resize()
{
if (_itemRange != null && _barRange != null && _barSize != Size.Empty)
{
ribbonItemBackground.Rect = ItemRectangle();
}
}
This caused the drawing problem mentioned in my question and the solution was to add
ribbonItem.InvalidateMeasure();
immediately after setting ribbonItemBackground.Rect.