I have a usercontrol with grid as content panel, which loads its content from datatemplate, specified in xaml where usercontrol is used.
I am using this usercontrol widely and everything is fine with standard xaml controls in template. now I am trying to show some charts in this control with OxyPlot
<DataTemplate x:Key="SomeChart">
<Grid x:Name="oxyGrid" >
<oxy:PlotView x:Name="oxyChart" Model="{Binding model}" />
</Grid>
</DataTemplate>
I initialize data model for the chart in usercontrol_loaded but the chart will not be shown until I manually call InvalidateMeasure for it. if I call invalidatemeasure from usercontrol_loaded , it will not help.
if I call invalidatemeasure from any point when chart is on the screen - it helps and chart will shows up.
currently, I found that I can call invalidatemeasure in usercontrol_layoutupdated handler but don't like as it fires too often and requires code outside of usercontrol.
if I try to handle event layoutupdated inside usercontrol and call invalidatemeasure (for oxychart) from there, I am getting "Layout cycle detected. Layout could not complete."
any ideas about what's wrong and how to fix :) will be greatly appreciated thanks in advance ilya