title: Problem with scroolview in Xamarin, no data is printed. It works when I retype ItemsSource (Persons) while application works
body: <p>It is my xaml file:</p>
  <pre><code>&lt;ContentPage xmlns=&quot;http://xamarin.com/schemas/2014/forms&quot;
           xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot; xmlns:mojaapkamobilna=&quot;clr-namespace:MojaApkaMobilna&quot; x:DataType=&quot;mojaapkamobilna:MainViewModel&quot;
           x:Class=&quot;MojaApkaMobilna.MainPage&quot;&gt;
  &lt;StackLayout&gt;
      &lt;Label x:Name=&quot;TopLabel&quot; Text=&quot;{Binding TopText}&quot;&gt;&lt;/Label&gt;
      &lt;StackLayout Orientation=&quot;Horizontal&quot;&gt;
          &lt;Label VerticalOptions=&quot;Center&quot;&gt;Imie:&lt;/Label&gt;
          &lt;Entry x:Name=&quot;Name&quot; Placeholder=&quot;Wpisz swoje imię&quot; WidthRequest=&quot;300&quot; Text=&quot;{Binding Name}&quot;&gt;&lt;/Entry&gt;
      &lt;/StackLayout&gt;
      &lt;StackLayout Orientation=&quot;Horizontal&quot;&gt;
          &lt;Label VerticalOptions=&quot;Center&quot;&gt;Haslo:&lt;/Label&gt;
          &lt;Entry x:Name=&quot;Password&quot; Placeholder =&quot;Wpisz swoje hasło&quot; IsPassword=&quot;True&quot; WidthRequest=&quot;300&quot; Text=&quot;{Binding Password}&quot;&gt;&lt;/Entry&gt;
      &lt;/StackLayout&gt;
      &lt;Button Text=&quot;Kliknij we mnie...&quot; Command = &quot;{Binding OnClickCommand}&quot;&gt;&lt;/Button&gt;
  
      &lt;ScrollView&gt;
          &lt;CollectionView ItemsSource=&quot;{Binding Persons}&quot;&gt;
              &lt;CollectionView.ItemTemplate&gt;
                 &lt;DataTemplate&gt;
                     &lt;StackLayout&gt;
                         &lt;Label FontSize=&quot;20&quot;  Text=&quot;{Binding Name}&quot; /&gt;
                          &lt;Label FontSize=&quot;20&quot; Text=&quot;{Binding Password}&quot;&gt;&lt;/Label&gt;
                     &lt;/StackLayout&gt;
                 &lt;/DataTemplate&gt;
              &lt;/CollectionView.ItemTemplate&gt;
          &lt;/CollectionView&gt;
      &lt;/ScrollView&gt;
      &lt;Button&gt;&lt;/Button&gt;
  &lt;/StackLayout&gt;
  </code></pre>
  
  <p>And it's my xaml.cs file:</p>
  <pre><code>namespace MojaApkaMobilna
  {
      public partial class MainPage : ContentPage
      {
          public MainPage()
          {
              InitializeComponent();
              BindingContext = new MainViewModel();
          }
      }
  }
  </code></pre>
  <p>And my view model class:</p>
  <pre><code> namespace MojaApkaMobilna
  {
      internal class MainViewModel : INotifyPropertyChanged
      {
          private string _name;
          private string _password;
          private string _topText;
  
          public ObservableCollection&lt;Person&gt; Persons { get; } = new ObservableCollection&lt;Person&gt;();
  
          public string TopText
          {
              get =&gt; _topText;
              set
              {
                  _topText = value;
                  OnPropertyChanged(nameof(TopText));
              }
          }
          public string Name
          {
              get =&gt; _name;
              set
              {
                  _name = value;
                  OnPropertyChanged(nameof(Name));
                  OnClickCommand.ChangeCanExecute();
              }
          }
          public string Password
          {
              get =&gt; _password;
              set
              {
                  _password = value;
                  OnPropertyChanged(nameof(Password));
                  OnClickCommand.ChangeCanExecute();
              }
          }
  
          public event PropertyChangedEventHandler PropertyChanged;
          public Command OnClickCommand { get; }
  
          private void Button_Clicked()
          {
              TopText = &quot;Wpisane imie: &quot; + Name + &quot;, Haslo: &quot; + Password;
  
              try
              {
                  Persons.Add(new Person(Name, Password));
                  foreach (var person in Persons)
                  {
                      Console.WriteLine(person.Name);
                      Console.WriteLine(person.Password);
                  }
  
                  Console.WriteLine(Persons.Count);
              }
              catch
              {
                  TopText = &quot;Nie powiódł się zapis nowego użytkownika&quot;;
              }
          }
  
          public MainViewModel()
          {
              OnClickCommand = new Command(Button_Clicked, Validate);
  
          }
  
  
          /* Informowanie widoku o zmianach */
          private void OnPropertyChanged(string propertyName)
          {
              PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
          }
  
          private bool Validate() =&gt; !string.IsNullOrWhiteSpace(Name) &amp;&amp; !string.IsNullOrWhiteSpace(Password);
          
      }
  }
  </code></pre>
  <p>And my problem is that my scroolview doesnt work. Interesting is that when program is running, when I delete that ItemsSource (xaml file) and write it again, it starts working. Why is it happening and how to repair it?</p>
  <pre><code> &lt;CollectionView ItemsSource=&quot;{Binding Persons}&quot;&gt;
  </code></pre>
  <p>I'm weak in Xamarin, so thank you for your understanding.</p>