问题描述
我的目标是让我的进度条保持动画状态,直到数据显示在屏幕上。
我继承了一个使用 Xceed DataGridControl 的项目,它可以很好地显示数据。然而,对于较大的数据集,比如 1000 行 30-40 列,当数据集更新时,UI 线程出现挂起一段时间,而 Xceed 代码更新数据网格,因此用户抱怨应用程序挂起,当其实只是忙而已。我有一个带有动画进度条的“请稍候”对话框,但是一旦 Xceed 开始更新网格,进度条就会冻结。等待时间还可以,我只需要保持动画播放,让用户知道应用程序没有挂起。有没有办法让 Xceed 代码在非 UI 线程上运行,或者有什么其他建议可以让动画继续运行?代码使用数据绑定来更新网格,我想我已经在下面展示了足够的代码来解释。任何提示表示赞赏!
C# 代码:
Results = DoSomeDatabaseStuff(); // This executes on a non UI thread,progress bar animating nicely
RaisePropertyChanged("Results"); // Now the progress bar hangs while Xceed code updates the Data Grid
xaml:
<Grid Margin="0,1" Grid.Row="1"/>
<xcdg:DataGridControl Grid.Row="1" x:Name="_dataGrid"
AutoCreateColumns="True"
NavigationBehavior="RowOnly"
SelectionUnit="Row"
SelectionChanged="_dataGrid_SelectionChanged"
ItemsSource="{Binding Results}" Grid.RowSpan="2" Background="White"
ItemsSourceChangeCompleted="_dataGrid_ItemsSourceChangeCompleted">
<xcdg:DataGridControl.View>
<xcdg:TableView UseDefaultHeadersFooters="False" IsAlternatingRowStyleEnabled="True" >
<xcdg:TableView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow AllowColumnReorder="True" AllowColumnResize="True" Height="40"/>
</DataTemplate>
</xcdg:TableView.FixedHeaders>
</xcdg:TableView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
</Grid>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)