Avalonia – Prevent MeasureOverride being called again if Children added

  Kiến thức lập trình

I am trying to port a Charting system from WPF to Avalonia.
My first attempt resulted in cylcic rendering and I eventually tracked this down. According to The Avalonia Layout documentation:
‘The process is invoked again if additional Children are added to the collection’
This obviously does not happen in WPF.
The original design constructed the Chart and it’s components in the MeasureOverride of each element. By first clearing the children and then building any sub elements as required.
It makes sense that this approach in Avalonia will result in cyclic rendering and I have a partially formed work around, though it runs the risk of beincoming convoluted and messy.

A simple clean solution is as the title says ‘Prevent MeasureOverride being called again if Children added’
So my question is, is there current mechanisim within Avalonia to allow this, since I already know my Measure is completed in the first pass?

LEAVE A COMMENT