title: .net maui Cannot get updated fields in an Observable collection to update in bound collection view
body: <p>I'm trying to update actual fields in an ObservableCollection that is bound to a CollectionView.</p>
  <p>The CollectionView updates fine on adding, removing items, but not if I programmatically change an item in the list.</p>
  <p>I understand from this post <a href="https://stackoverflow.com/questions/19981460/observable-collection-not-updated">Observable collection not updated</a> that I need to implement INotifyPropertyChanged.</p>
  <p>I am using the CommunityToolkit.Mvvm and had hoped that this kind of magic would be automatically done, but it appears not. I don't have the C# knowledge to know how to do what I want. Could someone help me please  :)</p>
  <p>There is a repo at <a href="https://github.com/gfmoore/TestCollectionBinding" rel="nofollow noreferrer">https://github.com/gfmoore/TestCollectionBinding</a></p>
  <p>and here is my current code:</p>
  <p>Views.MyItem.cs</p>
  <pre><code>
  namespace TestCollectionBinding.Views;
  
  public class MyItem
  {
    public string Name { get; set; }
    public string Device { get; set; }
  }
  </code></pre>
  <p>ViewModels.MainPageViewModel.cs</p>
  <pre><code>using CommunityToolkit.Mvvm.ComponentModel;
  using System;
  using System.Collections.Generic;
  using System.Collections.ObjectModel;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Input;
  using TestCollectionBinding.Views;
  
  namespace TestCollectionBinding.ViewModels;
  
  public partial class MainPageViewModel : ObservableObject
  {
    [ObservableProperty]
    public ObservableCollection&lt;MyItem&gt; myItems = new()
    {
      new MyItem
      {
        Name = &quot;Heart Rate Monitor&quot;,
        Device = &quot;12:12:12:12:AB&quot;
      },
  
      new MyItem
      {
        Name = &quot;Cadence&quot;,
        Device = &quot;34:34:34:34:CD&quot;
      }
    };
  
    //show details
    public ICommand ChangeCommand =&gt; new Command(ChangeControl);
    public void ChangeControl()
    {
      //change device
      foreach (MyItem q in MyItems)
      {
        q.Device = &quot;***********&quot;;
      }
      Console.WriteLine($&quot;Change device&quot;);
    }
  }
  
  </code></pre>
  <p>and the MainPage.xaml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;ContentPage xmlns=&quot;http://schemas.microsoft.com/dotnet/2021/maui&quot;
               xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot;
               xmlns:local=&quot;clr-namespace:TestCollectionBinding.ViewModels&quot;
               x:Class=&quot;TestCollectionBinding.MainPage&quot;&gt;
  
    &lt;ContentPage.BindingContext&gt;
      &lt;local:MainPageViewModel /&gt;
    &lt;/ContentPage.BindingContext&gt;
  
    &lt;StackLayout&gt;
      &lt;Label Text=&quot;Items&quot; 
             FontSize=&quot;20&quot;
             TextColor=&quot;Blue&quot;/&gt;
  
      &lt;CollectionView x:Name=&quot;MyItemsList&quot;
                      ItemsSource=&quot;{Binding MyItems}&quot;&gt;
        &lt;CollectionView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
            &lt;Grid
              Margin=&quot;10, 0, 10, 10&quot;
              ColumnDefinitions=&quot;200, 200&quot;&gt;
              &lt;Label Grid.Column=&quot;0&quot; 
                     Text=&quot;{Binding Name}&quot; 
                     FontSize=&quot;20&quot;/&gt;
  
              &lt;Label Grid.Column=&quot;1&quot; 
                     Text=&quot;{Binding Device}&quot; 
                     FontSize=&quot;20&quot;/&gt;            
            &lt;/Grid&gt;
     
          &lt;/DataTemplate&gt;
        &lt;/CollectionView.ItemTemplate&gt;
      &lt;/CollectionView&gt;
  
      &lt;Button
        Text=&quot;Change device names&quot;
        FontFamily=&quot;20&quot;
        WidthRequest=&quot;150&quot;
        Command=&quot;{Binding ChangeCommand}&quot; /&gt;
      
    &lt;/StackLayout&gt;
  
  &lt;/ContentPage&gt;
  
  </code></pre>
  <p>So the MainPage displays two items in the list and when I hit the button the command cycles through the list and just replaces the Device property with &quot;*********&quot;.</p>
  <p>I expect to see these changes in the displayed list.</p>
  <p>Oh for the days of ... dBase II lol</p>
  <p>G</p>