title: How do i bind ListView Data with List using MVVM
body: <p>I'm trying to bind List&lt;> to ListView. When i'm updating i'm going to clear the list. Clear on ObservableCollection was kind of slow.
  Problem is that in the view things are not updated correctly.</p>
  
  <p>XAML</p>
  
  <pre><code>&lt;StackPanel.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;common:BoolToBackgroundConverter x:Key="BoolToBackground"/&gt;
          &lt;tb:StringInlineCollectionConvertor x:Key="InlineConvert"/&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/StackPanel.Resources&gt;
  &lt;ListView ItemsSource="{Binding NotificationsCollection, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" 
              ScrollViewer.CanContentScroll="False"&gt;
      &lt;ListView.ItemsPanel&gt;
          &lt;ItemsPanelTemplate&gt;
              &lt;VirtualizingStackPanel/&gt;
          &lt;/ItemsPanelTemplate&gt;
      &lt;/ListView.ItemsPanel&gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Border&gt;
                  &lt;Grid Background="{Binding NotSeen,Converter={StaticResource BoolToBackground},UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"&gt;
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition Height="auto"/&gt;
                          &lt;RowDefinition Height="*"/&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition/&gt;
                          &lt;ColumnDefinition/&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;Image Source="{Binding Thumb}"/&gt;
                      &lt;tb:BindableTextBlock InlineCollection="{Binding Text, Converter={StaticResource InlineConvert}}"/&gt;
                      &lt;TextBlock Text="{Binding Created}"/&gt;
                  &lt;/Grid&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>C#
  ViewModel</p>
  
  <pre><code>public List&lt;NotificationDataModel&gt; notificationsCollection;
  public List&lt;NotificationDataModel&gt; NotificationsCollection
  {
      get
      {
          if (notificationsCollection == null)
          {
              notificationsCollection = new List&lt;NotificationDataModel&gt;();
          }
          return notificationsCollection;
      }
      set
      {
          if (notificationsCollection == null)
          {
              notificationsCollection = new List&lt;NotificationDataModel&gt;();
          }
          notificationsCollection.Clear();
          foreach (var item in value)
          {
              notificationsCollection.Add(item);
          }
          this.OnPropertyChanged("NotificationsCollection");
      }
  }
  
  public void UpdateNotifications1()
  {
      List&lt;NotificationDataModel&gt; newCollection = new List&lt;NotificationDataModel&gt;();
      newCollection.Add(item1);
      newCollection.Add(item2);
      newCollection.Add(item3);
      newCollection.Add(item4);
      newCollection.Add(item5);
      newCollection.Add(item6);
      this.NotificationsCollection = newCollection;
  }
  
  public void UpdateNotifications2()
  {
      List&lt;NotificationDataModel&gt; newCollection = new List&lt;NotificationDataModel&gt;();
      newCollection.Add(item1);
      newCollection.Add(item2);
      newCollection.Add(item6);
      this.NotificationsCollection = newCollection;
  }
  </code></pre>
  
  <p>When i call UpdateNotifications1 elements are show accordingly but after that when i call UpdateNotifications2 i see item1, item2 and item3 instead of item6.
  Also items are getting new value for the NotSeen(black for example, and initial is white) property after closing the view and on reopening those items should have white but they are still with black background.</p>