private void ToolsAndsettings_ListClickHandlerCommonEvent(System.Collections.ObjectModel.ObservableCollection <AudioModel> model, int selectedIndex) { LoadingList = true; if (selectedIndex != -1) { SelectedIndex = selectedIndex; AudioModel[] AudiomodelArry = new AudioModel[model.Count]; model.CopyTo(AudiomodelArry, 0); AudioCollection.Clear(); foreach (var Audio in AudiomodelArry) { AudioCollection.Add(Audio); } AudioListView.SelectedIndex = selectedIndex; AudioListView.ScrollIntoView(AudioCollection[SelectedIndex]); } LoadingList = false; }
/// <summary> /// Copies the entire <see cref="T:System.Collections.Generic.List`1" /> to a compatible one-dimensional array, starting at the specified index of the target array. /// </summary> /// <param name="array"> /// The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.List`1" />. The <see cref="T:System.Array" /> must have zero-based indexing. /// </param> /// <param name="arrayIndex"> /// The zero-based index in <paramref name="array" /> at which copying begins. /// </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="array" /> is <c>null</c>. /// </exception> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="arrayIndex" /> is less than 0. /// </exception> /// <exception cref="T:System.ArgumentException"> /// <paramref name="arrayIndex" /> is equal to or greater than the length of <paramref name="array" />. /// /// -or- /// /// The number of elements in the source <see cref="T:System.Collections.Generic.List`1" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />. /// </exception> public void CopyTo(TBase[] array, int arrayIndex) { _innerCollection.CopyTo((TActual[])array, arrayIndex); }