码迷,mamicode.com
首页 > 其他好文 > 详细

RadControls RadGridView 显示加载数据时间

时间:2015-03-09 16:02:31      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:

<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));
        }

    }
}

 

RadControls RadGridView 显示加载数据时间

标签:

原文地址:http://www.cnblogs.com/gaohao/p/4323658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!