/// <summary> /// Remove the specified token from the list. /// </summary> /// <param name="item">Item in the list to delete</param> /// <param name="data">data </param> /// <remarks> /// the data parameter is passed in optionally to support UX UTs. When running in the UT the Container items are not manifest. /// </remarks> /// <returns><b>true</b> if the item was removed successfully, <b>false</b> otherwise</returns> private async Task <bool> RemoveTokenAsync(TokenizingTextBoxItem item, object data = null) { if (data == null) { data = ItemFromContainer(item); } if (TokenItemRemoving != null) { var tirea = new TokenItemRemovingEventArgs(data, item); await TokenItemRemoving.InvokeAsync(this, tirea); if (tirea.Cancel) { return(false); } } _innerItemsSource.Remove(data); TokenItemRemoved?.Invoke(this, data); GuardAgainstPlaceholderTextLayoutIssue(); return(true); }
private async Task RemoveToken(TokenizingTextBoxItem item) { var data = ItemFromContainer(item); if (TokenItemRemoving != null) { var tirea = new TokenItemRemovingEventArgs(data, item); await TokenItemRemoving.InvokeAsync(this, tirea); if (tirea.Cancel) { return; } } _innerItemsSource.Remove(data); TokenItemRemoved?.Invoke(this, data); }