System.Windows.Data.CollectionViewSource.DeferRefresh C# (CSharp) Method

DeferRefresh() public method

public DeferRefresh ( ) : IDisposable
return IDisposable
		public IDisposable DeferRefresh ()
		{
			return new Deferrer (this);
		}

Usage Example

示例#1
0
        // Constructor
        public TaskListPage()
        {
            InitializeComponent();

            // trace data
            TraceHelper.AddMessage("TaskList: constructor");

            // set some data context information
            ConnectedIconImage.DataContext = App.ViewModel;
            SpeechProgressBar.DataContext = App.ViewModel;

            // set some data context information for the speech UI
            SpeechPopup_SpeakButton.DataContext = this;
            SpeechPopup_CancelButton.DataContext = this;
            SpeechLabel.DataContext = this;

            OrderedSource = new List<CollectionViewSource>();

            // add the name viewsource (which is a sorted view of the tasklist by name)
            var nameViewSource = new CollectionViewSource();
            using (nameViewSource.DeferRefresh())
            {
                nameViewSource.SortDescriptions.Add(new SortDescription("Complete", ListSortDirection.Ascending));
                nameViewSource.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
                OrderedSource.Add(nameViewSource);
                ByNameListBox.DataContext = this;
            }
            // add the due viewsource (which is a sorted view of the tasklist by due date)
            var dueViewSource = new CollectionViewSource();
            using (dueViewSource.DeferRefresh())
            {
                dueViewSource.SortDescriptions.Add(new SortDescription("Complete", ListSortDirection.Ascending));
                dueViewSource.SortDescriptions.Add(new SortDescription("DueSort", ListSortDirection.Ascending));
                dueViewSource.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
                OrderedSource.Add(dueViewSource);
                ByDueListBox.DataContext = this;
            }
            // add the priority viewsource (which is a sorted view of the tasklist by priority)
            var priViewSource = new CollectionViewSource();
            using (priViewSource.DeferRefresh())
            {
                priViewSource.SortDescriptions.Add(new SortDescription("Complete", ListSortDirection.Ascending));
                priViewSource.SortDescriptions.Add(new SortDescription("PriorityIDSort", ListSortDirection.Descending));
                priViewSource.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
                OrderedSource.Add(priViewSource);
                ByPriListBox.DataContext = this;
            }
            ImportTemplateViewSource = new CollectionViewSource();
            ImportTemplateViewSource.Filter += new FilterEventHandler(ImportTemplate_Filter);

            Loaded += new RoutedEventHandler(TaskListPage_Loaded);
            BackKeyPress += new EventHandler<CancelEventArgs>(TaskListPage_BackKeyPress);

            // trace data
            TraceHelper.AddMessage("Exiting TaskList constructor");
        }
All Usage Examples Of System.Windows.Data.CollectionViewSource::DeferRefresh