简体   繁体   中英

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM