title: *.StartPageControl.ClioViewModel.Groups' is a 'property' but is used like a 'type' error when trying to add element to ObservableCollection<string>
body: <p>I am trying to add a comboBox to an already existing WPF form.  I have created the comboBox code in XAML and added the appropriate code in my ViewModel class.  However, when I attempt to add my comboBox items to my ObservableCollection, I receive the following error:</p>
  
  <pre><code>'AECI.Clio.StartPageControl.ClioViewModel.Groups' is a 'property' but is used like a 'type'   
  </code></pre>
  
  <p>Here my the XAML code for the comboBox:</p>
  
  <pre><code>&lt;ComboBox Name="GroupComboBox" ItemsSource="{Binding Groups}" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" Width="132" Height="22" Grid.Column="0" Grid.Row="3" Margin="0,30" VerticalAlignment="Top" &gt;    &lt;/ComboBox&gt;
  </code></pre>
  
  <p>Here is my C# code:</p>
  
  <pre><code>public class ClioViewModel : INotifyPropertyChanged 
  { 
      public event PropertyChangedEventHandler PropertyChanged;
  
      protected void OnPropertyChanged(string propertyName)  
      {
          PropertyChangedEventHandler handler = PropertyChanged;
          if (handler != null)
          {
              handler(this, new PropertyChangedEventArgs(propertyName));
          }
      } 
  
      private ObservableCollection&lt;string&gt; _groups = new ObservableCollection&lt;string&gt;();
  
      public ObservableCollection&lt;string&gt; Groups 
      { 
          get { return _groups; } set { _groups = value; OnPropertyChanged("Groups");   }   
      } 
  
  Groups.Add("Data Warehouse"); &lt;-- Here is where I get the error 
  </code></pre>
  
  <p>I do not know what I am doing wrong.  Please advise.  </p>
  
  <p>EDIT:</p>
  
  <p>Per request, here is the whole.  I didn't post the whole thing from the get-go because  it's pretty big.</p>
  
  <pre><code>namespace AECI.Clio.StartPageControl
  {
      public class ClioViewModel : INotifyPropertyChanged
      {
          private Timer _timer;
  
          public ClioViewModel()
          {
              Harvesters = new ObservableCollection&lt;Harvester&gt;();
          _   timer = new Timer((o) =&gt; Application.Current.Dispatcher.BeginInvoke(new Action(LoadAllHarvester)), new object(), TimeSpan.FromMilliseconds(1), TimeSpan.FromMinutes(1));           
      }
  
      private void LoadAllHarvester()
      {
          Harvesters.Clear();
          foreach(var h in HarvesterModel.GetAllHarvesters())
          {
              Harvesters.Add(h);
          }
      }
  
      public ObservableCollection&lt;Harvester&gt; Harvesters { get; set; }
  
      private Harvester _selectedHarvester;
  
      public Harvester SelectedHarvester
      {
          get { return _selectedHarvester; }
          set
          {
              _selectedHarvester = value;
              if (_selectedHarvester != null)
              {
                  _selectedHarvester.PropertyChanged += _selectedHarvester_PropertyChanged;
              }
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("SelectedHarvester"));
                  PropertyChanged(this, new PropertyChangedEventArgs("Selected"));
                  PropertyChanged(this, new PropertyChangedEventArgs("SelectedAndNotLoading"));
              }
          }
      }
  
      private DateTime _harvestDateStart = DateTime.Today;
      public DateTime HarvestDateStart
      {
          get { return _harvestDateStart; }
          set
          {
              _harvestDateStart = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("HarvestDateStart"));
              }
          }
      }
  
      void _selectedHarvester_PropertyChanged(object sender, PropertyChangedEventArgs e)
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs("SelectedHarvester"));
          }
      }
  
      public bool Selected
      {
          get
          {
              return SelectedHarvester != null;
          }
      }
  
      public bool SelectedAndNotLoading { get { return Selected &amp;&amp; !PostOccuring; } }
  
      public bool HarvesterPostRequested { get { return false; } set { PostSelectedHarvester(); } }
      public bool HarvesterPauseRequested { get { return false; } set { PauseSelectedHarvester(); } }
      public bool HarvesterUnpauseRequested { get { return false; } set { UnpauseSelectedHarvester(); } }
  
  
      private bool _postOccuring;
  
      public bool PostOccuring
      {
          get { return _postOccuring; }
          set
          {
              _postOccuring = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("PostOccuring"));
                  PropertyChanged(this, new PropertyChangedEventArgs("SelectedAndNotLoading"));
              }
          }
      }
  
      private void PostSelectedHarvester()
      {
          PostOccuring = true;
          HarvesterModel.UpdateHarvester(SelectedHarvester);
          PostOccuring = false;
      }
  
      private void UnpauseSelectedHarvester()
      {
          if (SelectedHarvester != null)
          {
              SelectedHarvester.NextRunTimeUTC = DateTime.UtcNow;
              PostSelectedHarvester();
              SelectedHarvester.CanPause = true;
              SelectedHarvester.CanResume = false;
          }
      }
  
      private void PauseSelectedHarvester()
      {
          if (SelectedHarvester != null)
          {
              SelectedHarvester.NextRunTimeUTC = null;
              PostSelectedHarvester();
              SelectedHarvester.CanPause = false;
              SelectedHarvester.CanResume = true;
          }
      }
  
      public bool HarvestRequested { get { return false; } set { HarvestDataNow(); } }
  
      public void HarvestDataNow()
      {
          var t = HarvestDateStart;
          if (t &gt; DateTime.Now || SelectedHarvester == null)
          {
              return;
          }
          PostOccuring = true;
          HarvesterModel.HarvestDataNow(SelectedHarvester, t, DateTime.Now);
          PostOccuring = false;
      }
  
      #region Implementation of INotifyPropertyChanged
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      #endregion
  
      protected void OnPropertyChanged(string propertyName)  
      {
          PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
      }
  
      private ObservableCollection&lt;string&gt; _groups = new ObservableCollection&lt;string&gt;();
  
      public ObservableCollection&lt;string&gt; Groups 
      { 
          get 
          { 
              return _groups; 
          }
          set
          {
              _groups = value;
              OnPropertyChanged("Groups"); 
          }            
      }
      Groups.Add("Data Warehouse");        
  
      private ObservableCollection&lt;string&gt; _selectedGroups = new ObservableCollection&lt;string&gt;();
  
      public ObservableCollection&lt;string&gt; SelectedGroups 
      { 
          get
          {
              return _selectedGroups;
          }
          set
          {
              _selectedGroups = value;
              OnPropertyChanged("SelectedGroups");            
          }
      }        
  
      private string _mySelectedItem;
      public string MySelectedItem
      {
          get{return this._mySelectedItem;}
          set{this._mySelectedItem=value; OnPropertyChanged("MySelectedItem");}
      }      
  
  }
  
  public static class HarvesterModel
  {
      private static readonly EndpointAddress ENDPOINT = new EndpointAddress(new Uri("http://LocalHost:49350/POWDataWarehouseFeeder/V1/Silverlight"));
      private static readonly BasicHttpBinding BINDING;
  
      static HarvesterModel()
      {
          BINDING = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
          BINDING.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
          BINDING.SendTimeout = TimeSpan.FromMinutes(5);
          BINDING.ReceiveTimeout = TimeSpan.FromMinutes(5);
      }
  
      private static Dictionary&lt;Guid, Clio.HarvesterRecord&gt; Harvesters { get; set; }
  
      public static void HarvestDataNow(Harvester harvey, DateTime stime, DateTime etime)
      {
          var client = new Clio.ClioManagerV1Client(BINDING, ENDPOINT);
  
          try
          {
              client.HarvestDataImmediate(new DataHarvestTarget[] { new DataHarvestTarget { EndTimeUTC = etime.ToUniversalTime(), StartTimeUTC = stime.ToUniversalTime(), HarvesterGuid = harvey.HarvesterGuid.ToString(), EndTimeUTCSpecified = true, StartTimeUTCSpecified = true } });
          }
          catch {}
  
      }
  
      public static ICollection&lt;Harvester&gt; GetAllHarvesters()
      {
          var client = new Clio.ClioManagerV1Client(BINDING, ENDPOINT);
          HarvesterRecord[] harvs;
          try
          {
              harvs = client.GetHarvesters();
          }
          catch(Exception e)
          {
              harvs = new HarvesterRecord[0];
          }
          foreach (var record in harvs)
          {
              record.HarvesterConfigurationXML.Attributes.RemoveAll();
          }
          Harvesters = harvs.ToDictionary(n =&gt; new Guid(n.HarvesterGuid), n =&gt; n);
  
          return
                      harvs.Select(
                                  n =&gt;
                                  new Harvester
                                      {
                                          Configuration = XElement.Parse(n.HarvesterConfigurationXML.OuterXml).ToString(),
                                          HarvesterGuid = new Guid(n.HarvesterGuid),
                                          HarvesterName = n.HarvesterName,
                                          LastRunMessage = n.LastRunMessage,
                                          LastRunSuccess = n.LastRunResult == HarvestResults.Success,
                                          LastRunTimeUTC = n.LastRunTimeUTC,
                                          NextRunTimeUTC = n.NextScheduledRunTimeUTC,
                                          CanPause = n.LastRunTimeUTC != null,
                                          CanResume = n.LastRunTimeUTC == null,
                                          Schedules = new List&lt;HarvesterSchedule&gt;(n.HarvesterRunScheduleList.Select(h =&gt; new HarvesterSchedule { Schedule = h.Schedule, Window = System.Xml.XmlConvert.ToTimeSpan(h.WindowLength), Offset = System.Xml.XmlConvert.ToTimeSpan(h.Offset) })),
                                      }).ToList();
      }
  
      public static void UpdateHarvester(Harvester harvey)
      {
          var old = Harvesters[harvey.HarvesterGuid];
          var oldPost = new Clio.HarvesterPost
                            {
                                GACFullAssemblyName = old.GACFullAssemblyName,
                                HarvesterConfigurationXML = old.HarvesterConfigurationXML,
                                HarvesterGuid = old.HarvesterGuid,
                                HarvesterName = old.HarvesterName,
                                HarvesterRunScheduleList = old.HarvesterRunScheduleList
                            };
          XmlDocument doc = new XmlDocument();
          doc.LoadXml(harvey.Configuration);
          var newPost = new Clio.HarvesterPost
                            {
                                GACFullAssemblyName = old.GACFullAssemblyName,
                                HarvesterConfigurationXML = doc.DocumentElement,
                                HarvesterGuid = old.HarvesterGuid,
                                HarvesterName = harvey.HarvesterName,
                                IsExeucting = harvey.NextRunTimeUTC != null,
                                IsExeuctingSpecified = true,
                                HarvesterRunScheduleList = harvey.Schedules.Select(s =&gt; new Clio.HarvesterRunSchedule { Schedule = s.Schedule, Offset = System.Xml.XmlConvert.ToString(s.Offset), WindowLength = System.Xml.XmlConvert.ToString(s.Window) }).ToArray()
                            };
  
          var client = new Clio.ClioManagerV1Client(BINDING, ENDPOINT);
          var result = client.PostHarvesters(new[] { new HarvesterPostRequest { Current = oldPost, Updated = newPost } });
          return;
      }
  }
  
  public class Harvester : INotifyPropertyChanged
  {
      public Guid HarvesterGuid { get; set; }
      public string HarvesterName { get; set; }
      public DateTime LastRunTimeUTC { get; set; }
      public DateTime LastRunTimeLocal { get { return LastRunTimeUTC.ToLocalTime(); } }
      public DateTime? NextRunTimeUTC { get; set; }
      public DateTime? NextRunTimeLocal { get { return (NextRunTimeUTC ?? DateTime.MinValue).ToLocalTime(); } }
      public bool LastRunSuccess { get; set; }
      public string LastRunMessage { get; set; }
      public string Configuration { get; set; }
      public ICollection&lt;HarvesterSchedule&gt; Schedules { get; set; }
  
      private bool _canPause;
  
      public bool CanPause
      {
          get { return _canPause; }
          set
          {
              _canPause = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("CanPause"));
              }
          }
      }
      private bool _canResume;
  
      public bool CanResume
      {
          get { return _canResume; }
          set
          {
              _canResume = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("CanResume"));
              }
          }
      }
  
      private bool _editXML;
  
      public bool EditXML
      {
          get { return _editXML; }
          set
          {
              _editXML = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("EditXML"));
              }
          }
      }
  
      #region Implementation of INotifyPropertyChanged
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      #endregion
  }
  
  public class HarvesterSchedule : INotifyPropertyChanged
  {
  
      private string _schedule;
  
      public string Schedule
      {
          get { return _schedule; }
          set
          {
              _schedule = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("Schedule"));
              }
          }
      }
  
      private TimeSpan _offset;
  
      public TimeSpan Offset
      {
          get { return _offset; }
          set
          {
              _offset = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("Offset"));
              }
          }
      }
  
      private TimeSpan _window;
  
      public TimeSpan Window
      {
          get { return _window; }
          set
          {
              _window = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("Window"));
              }
          }
      }
  
      #region Implementation of INotifyPropertyChanged
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      #endregion
  }
  
  public class SuccessBoolToColorConverter : IValueConverter
  {
      #region Implementation of IValueConverter
  
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if (value is bool &amp;&amp; (bool)value)
          {
              return new SolidColorBrush(Colors.AliceBlue);
          }
          return new SolidColorBrush(Colors.Tomato);
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if (value is Color &amp;&amp; (Color)value == Colors.AliceBlue)
          {
              return true;
          }
          return false;
      }
  
      #endregion
  }
  
  public class BoolToVisibilityConverter : IValueConverter
  {
      #region Implementation of IValueConverter
  
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if (value is bool &amp;&amp; (bool)value)
          {
              return Visibility.Visible;
          }
          return Visibility.Collapsed;
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if (value is Visibility &amp;&amp; (Visibility)value == Visibility.Visible)
          {
              return true;
          }
          return false;
      }
  
      #endregion
  }
  
  public class HarvesterToCheckedConverter : IValueConverter
  {
      #region Implementation of IValueConverter
  
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if (value == null)
          {
              return true;
          }
          return false;
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          return null;
      }
  
      #endregion
  }
  
  public class HarvesterLoading : IValueConverter
  {
      #region Implementation of IValueConverter
  
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          if(value is bool &amp;&amp; (bool)value)
          {
              return 0.0;
          }
          return 1.0;
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          throw new NotImplementedException();
      }
  
      #endregion
  }
  </code></pre>