RadControls RadGridView 显示加载数据时间
<TextBlock x:Name="TextBlock1" Margin="8" HorizontalAlignment="Left" Width="200" />
using IDOSSalesBizLogic; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace RadControlsWpfAppTest { /// <summary> /// SalesOrder.xaml 的交互逻辑 /// </summary> public partial class SalesOrder : Window { ReadIDOSSalesData rd = new ReadIDOSSalesData(); DateTime start; public SalesOrder() { InitializeComponent(); LoadData(); radGridView.Sorting += ResetTime; radGridView.Grouping += ResetTime; radGridView.Filtering += ResetTime; ResetTimeAndSubscribeToLayoutUpdated(); } public void LoadData() { radGridView.ItemsSource = rd.ReadSalesOrder(); } void ResetTime(object sender, EventArgs e) { ResetTimeAndSubscribeToLayoutUpdated(); } private void ResetTimeAndSubscribeToLayoutUpdated() { radGridView.LayoutUpdated += radGridView_LayoutUpdated; start = DateTime.Now; } void radGridView_LayoutUpdated(object sender, EventArgs e) { radGridView.LayoutUpdated -= radGridView_LayoutUpdated; TextBlock1.Text = String.Format("Total time to load: {0} ms", Math.Round((DateTime.Now - start).TotalMilliseconds)); } } }