예제 #1
0
        protected override void ClearItems()
        {
            if (RangeActionsSupported)
            {
                var    removed = new List <T>(this);
                Action action  = () =>
                {
                    base.ClearItems();
                    base.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removed));
                };

                if (_dispatcherHelper != null)
                {
                    _dispatcherHelper.InvokeOnUiThread(() => action.Invoke());
                    return;
                }

                action.Invoke();
            }
            else
            {
                while (Count > 0)
                {
                    RemoveAt(Count - 1);
                }
            }
        }
예제 #2
0
 public void RaiseCanExecuteChanged()
 {
     _dispatcherHelper.InvokeOnUiThread(() =>
     {
         _command.RaiseCanExecuteChanged();
         CanExecuteChanged?.Invoke(this, EventArgs.Empty);
     });
 }