UIElement 的渲染导致应用程序挂起几秒钟
我有一个 WPF 应用程序 - 使用 MVVM 进行设计模式。
在主视图中,有一个 ContentPresenter
绑定到相应 ViewModel 中的属性。我有与该属性关联的数据类型的类型引用DataTemplate
。本质上,根据用户执行的特定操作,ContentPresenter
将显示来自特定数据模板的数据。在数据模板中,我有 DevExpress 的 GridControl。它很糟糕,我讨厌它,但由于公司标准,我必须使用它。我的主要痛点是,由于这个 GridControl
,UI 需要花费几秒钟的时间才能呈现到数据模板。我可以做些什么来缓解这种情况吗?我想显示一个“请稍候”进度指示器,但即使这样也会卡住几秒钟......
请帮忙。
I have a WPF application - using MVVM for the design pattern.
In the Main View, there is a ContentPresenter
that is bound to a property in the corresponding ViewModel. I have type-referential DataTemplate
for the data type associated with that property. Essentially, based on a certain action performed by the user, the ContentPresenter
will display the data from a specific data template. In the data template I have DevExpress' GridControl
. It sucks and I hate it, but due to company standards, I have to use it. My main pain point is that it takes several noticeable seconds for the UI to render to data template because of this GridControl
. Is there anything that I can do to mitigate this? I'd like to display a "please wait" progress indicator, but even that gets stuck for several seconds...
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否正在为此视图异步加载数据?
如果显示视图时数据尚未加载,您可以尝试延迟加载,直到网格可见,加载数据并最终在代码隐藏中设置与网格的绑定,如下所示:
这将给出 gui在加载开始之前有机会展示自己。
HTH。
Are you loading the data for this view async ?
If the data is not already loaded when you display the view, you could try to delay the loading until the grid is visible, the load the data and finally set the binding to the grid in codebehind, something like this:
This will give the gui a chance to show itself before the loading starts.
HTH.