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); } } }
public void RaiseCanExecuteChanged() { _dispatcherHelper.InvokeOnUiThread(() => { _command.RaiseCanExecuteChanged(); CanExecuteChanged?.Invoke(this, EventArgs.Empty); }); }