C#中添加水晶报表到tabcontrol时出现问题
我们正在动态配置 Crystal 报表,当我们在单独的窗口中显示它或将报表动态添加到 C# WPF StackPanel 时,一切都会正常工作。
但是当我们尝试将它们作为 TabItem 添加到 TabControl 时,我们会从PresentationFramework 中得到一个异常:
e.Message = "指定索引超出 索引处的范围或子级为空。做 如果不调用此方法 VisualChildrenCount 返回零, 表明视觉没有 孩子。\r\n参数名称: 索引\r\n实际值为 0。"
如何避免此崩溃,以便我们可以在 TabControl 中获得水晶报告?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我尝试将 ComponentArt 和 Telerik 控件放入 Silverlight 中的 TabControl 中时,我遇到了同样的问题。我必须确保我不会尝试加载任何带有数据的组件,除非包含这些控件的选项卡是活动选项卡。
我最终将初始化从 silverlight 页面的加载事件转移到我认为的选项卡控件 SelectionChanged 事件中的某些逻辑。
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.