escape-llc/yet-another-chart-component

Value Label Positioning Errors

Closed this issue · 0 comments

Summary

There is some error in positioning the FrameworkElement

  • on initiali entry to the visual tree,
  • when the element is recycled, and the text changes in a way where its ActualWidth changes.

Actual Behavior

Because the XAML Measure and Arrange cycle occurs in a separate unit-of-work, it's not possible to reliably ascertain its ActualSize in the UOW where InvalidateXXX are called.

This manifests itself as mis-positioned text labels; in particular, the Canvas.Left property may be set incorrectly, due to the race condition described above.

Expected Behavior

Bite the bullet and attach the SizeChanged event, and save enough bookkeeping to re-create the "real" positioning when that event actually fires.

Additional Details

If the size does not really change (even if Text does), the SizeChanged event does not fire. This provides a minor complication for Transforms; it must force a positioning "just in case" the event is not triggered.

Actually, it only requires to force a measure/arrange pass, if we are in a full render, otherwise it is sufficient to update the current position based on the transforms.