title: CS0120 An object reference is required for the non-static field, method, or property 'Group.Title'
body: <p>I'm having a problem with my UWP app and creating a favorites page which allows the user to reorder and save the data on the page. i'm getting the same error on two occasions  </p>
  
  <blockquote>
    <p>CS0120    An object reference is required for the non-static field, method, or property 'Group.Title' </p>
    
    <p>CS0120    An object reference is required for the non-static field, method, or property 'Group.Items'</p>
  </blockquote>
  
  <p>could anyone explain to me why this is happening, 
  thanks.</p>
  
  <p>CS File</p>
  
  <hr>
  
  <pre><code>using App1.Common;
  using App1.Data;
  using Newtonsoft.Json;
  using System;
  using System.Collections.Generic;
  using System.Collections.ObjectModel;
  using Windows.Storage;
  using Windows.UI.Popups;
  using Windows.UI.Xaml.Controls;
  using Windows.UI.Xaml.Navigation;
  using System.Linq;
  using System.Threading.Tasks;
  using Windows.Data.Json;
  
  
  namespace App1
  {
  
  public sealed partial class test : Page
  {
      public ObservableCollection&lt;ItemData&gt; Items { get; set; }
  
      private ObservableDictionary defaultViewModel = new 
      ObservableDictionary();
      private NavigationHelper navigationHelper;
      private RootObject jsonLines;
      private StorageFile fileFavourites;
      private Dictionary&lt;string, ItemData&gt; ItemData = new Dictionary&lt;string, 
      ItemData&gt;();
  
  
      public test()
      {
      loadJson();
      getFavoritesFile();
  
      this.InitializeComponent();
      this.navigationHelper = new NavigationHelper(this);
      this.navigationHelper.LoadState += navigationHelper_LoadState;
      }
  
      void ItemView_ItemClick(object sender, ItemClickEventArgs e)
      {
          // Navigate to the appropriate destination page, configuring the new 
          page
          // by passing required information as a navigation parameter
          var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
          this.Frame.Navigate(typeof(GroupedItemsPage), itemId);
      }
  
      private void setupObservableCollection()
          {
              Items = new ObservableCollection&lt;ItemData&gt;(ItemData.Values);
              itemGridView.ItemsSource = Items;
          }
  
          private async void loadJson()
          {
              var file = await StorageFile.GetFileFromApplicationUriAsync(new 
              Uri("ms-appx:///DataModel/SampleData.json"));
              var lines = await FileIO.ReadTextAsync(file);
              jsonLines = JsonConvert.DeserializeObject&lt;RootObject&gt;(lines);
              feedItems();
          }
  
          private async void getFavoritesFile()
          {
              Windows.Storage.StorageFolder storageFolder = 
              Windows.Storage.ApplicationData.Current.LocalFolder;
              fileFavourites = await storageFolder.GetFileAsync("Fav.txt");
          }
  
          private async void feedItems()
          {
              if (await FileIO.ReadTextAsync(fileFavourites) != "")
              {
                  foreach (var line in await 
                  FileIO.ReadLinesAsync(fileFavourites))
                  {
                      foreach (var Group in jsonLines.Groups)
                      {
                      foreach (var Item in Group.Items)
                      {
                          if (Item.UniqueId == line)
                          {
                              var storage = new ItemData()
                              {
                                  Title = Item.Title,
                                  UniqueID = Item.UniqueId,
                                  ImagePath = Item.ImagePath,
                                  Group = Group.Title
                              };
                              ItemData.Add(storage.UniqueID, storage);
                          }
                      }
                  }
                  }
              }
              else
              {//if favourites file is empty, use?
              foreach (var Group in jsonLines.Groups) ;
              {
                  foreach (var Item in Group.Items)
                  {
                      var storage = new ItemData()
                      {
                          Title = Item.Title,
                          UniqueID = Item.UniqueId,
                          ImagePath = Item.ImagePath,
                          Group = Group.Title
                      };
                      ItemData.Add(storage.UniqueID, storage);
                      await FileIO.AppendTextAsync(fileFavourites, 
                      Item.UniqueId + "\r\n");
                  }
              }
          }
  
  
          setupObservableCollection();
          }
  
  
          public ObservableDictionary DefaultViewModel
          {
              get { return this.defaultViewModel; }
          }
  
          #region NavigationHelper loader
  
          public NavigationHelper NavigationHelper
          {
              get { return this.navigationHelper; }
          }
  
          private async void MessageBox(string Message)
          {
              MessageDialog dialog = new MessageDialog(Message);
              await dialog.ShowAsync();
          }
  
          private async void navigationHelper_LoadState(object sender, 
          LoadStateEventArgs e)
          {
              var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
              this.defaultViewModel["Groups"] = sampleDataGroups;
          }
  
          #endregion NavigationHelper loader
  
          #region NavigationHelper registration
  
          protected override void OnNavigatedFrom(NavigationEventArgs e)
          {
              navigationHelper.OnNavigatedFrom(e);
          }
  
          protected override void OnNavigatedTo(NavigationEventArgs e)
          {
              navigationHelper.OnNavigatedTo(e);
          }
  
          #endregion NavigationHelper registration
      }
  
      public class ItemData
      {
          public string UniqueID { get; set; }
          public string Title { get; set; }
          public string Group { get; set; }
          public string ImagePath { get; set; }
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>RootObject File</p>
  
  <pre><code>using App1.Data;
  using System.Collections;
  using System.Collections.Generic;
  using System.Threading.Tasks;
  
  namespace App1
  {
  
  public class Item
  {
      public string UniqueId { get; set; }
      public string Title { get; set; }
      public string Subtitle { get; set; }
      public string ImagePath { get; set; }
      public string Description { get; set; }
      public string Content { get; set; }
  }
  
  public class Group
  {
      public string UniqueId { get; set; }
      public string Title { get; set; }
      public string Subtitle { get; set; }
      public string ImagePath { get; set; }
      public string Description { get; set; }
      public List&lt;Item&gt; Items { get; set; }
  }
  
  public class RootObject
  {
      public List&lt;Group&gt; Groups { get; set; }
  }  
  }
  </code></pre>