So after much banging our heads against the wall we discovered that because our root visual was a ScrollViewer that contained a Content Control which we use to swap content in and out of we ran into this Layout Error Code due to a race condition within the ScrollViewer and the contained content.
Lesson Learned: Don’t but an Accordion Control into a ScrollViewer.
Make sure when adding an AccordingItem, the IsSelected property is set to false.
If you want to have it selected, do the above and add the following
accordionItem.Loaded += new RoutedEventHandler(accordionItem_Loaded);
void accordionItem_Loaded(object sender, RoutedEventArgs e)
{
var accordionItem = sender as AccordionItem;
accordionItem.IsSelected = true;
}
LikeLike