Problem when adding Crystal report to tabcontrol in C#
We are dynamically configuring a Crystal report and when we show it in a separate window or dynamically adding reports to a C# WPF StackPanel everything is working as it should.
But when we try to add them as TabItems to a TabControl we get an exception from PresentationFramework saying:
e.Message = "Specified index is out of range or child开发者_Python百科 at index is null. Do not call this method if VisualChildrenCount returns zero, indicating that the Visual has no children.\r\nParameter name: index\r\nActual value was 0."
How do I avoid this crash so that we can have crystal report in our TabControl?
I've had the same problem when trying to put ComponentArt and Telerik controls inside of a TabControl in Silverlight. I had to make sure that I didn't try to load any of the components with data unless the tab that was containing those controls was the active one.
I ended up moving the initialization from the silverlight page's load event over to some logic in the Tab Controls SelectionChanged event I believe.
精彩评论