에러


System.Exception was unhandled by user code

  HResult=-2147418113

  Message=Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

  Source=mscorlib

  StackTrace:

       at System.Runtime.InteropServices.WindowsRuntime.IVector`1.Clear()

       at System.Runtime.InteropServices.WindowsRuntime.VectorToCollectionAdapter.Clear[T]()

       at CrossPlatform.Universal.Windows.Behaviors.SelectedItemsBehavior.ViewModelToControl_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)

       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

       at System.Collections.ObjectModel.ObservableCollection`1.ClearItems()

       at System.Collections.ObjectModel.Collection`1.Clear()

       at OneSearch.Universal.ViewModels.ProgressPageVM.<OnInitLocalReactiveCommand>b__13(Object obj)

       at System.Reactive.AnonymousObserver`1.OnNextCore(T value)

       at System.Reactive.ObserverBase`1.OnNext(T value)

       at System.Reactive.Subjects.Subject`1.OnNext(T value)

       at System.Reactive.Linq.ObservableImpl.Do`1._.OnNext(TSource value)

  InnerException: 



에러 발생 위치

            var control = AssociatedObject as ListViewBase;


            //Reset처리

            if (e.Action == NotifyCollectionChangedAction.Reset)

            {

                if (control != null) control.SelectedItems.Clear();

            }



에러 발생 원인


GridView control이나 ListView control에서 SelectionMode가 Single인데 SelectedItems를 사용해서 발생한 오류



해결


<GridView ItemsSource="{Binding BackgroundOperationItems}" Padding="120,140,120,50" 

 ItemTemplateSelector="{StaticResource BackgroundItemTemplateSelector}" Grid.RowSpan="2" SelectionMode="Multiple">

<Interactivity:Interaction.Behaviors>

<Behaviors:SelectedItemsBehavior SelectedItems="{Binding BackgroundSelectedItems}"/>

</Interactivity:Interaction.Behaviors>

</GridView>     


블로그 이미지

MVP kaki104

* Microsoft MVP - Windows Development 2014 ~ 2019 5ring * LINE : kaki104 * facebook : https://www.facebook.com/kaki104 https://www.facebook.com/groups/w10app/

티스토리 툴바