Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ItemObservableCollection

ItemObservableCollection

Scheduled Pinned Locked Moved C#
csharplinqregexhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rex64
    wrote on last edited by
    #1

    I have an ItemObservableCollection called _MyChildren with a collection of clsChild. I am trying to get nonfictions when a clsChild.name string is changed. Error I am getting on MyChildren.ItemPropertyChanged:

    Severity Code Description Project File Line Suppression State
    Error CS1661 Cannot convert anonymous method to type 'EventHandler>' because the parameter types do not match the delegate parameter types C-Sharp-Tests C:\Users\Jeff\Documents\GitHub\C-Sharp-Tests\C-Sharp-Tests\C-Sharp-Tests\clsParent.cs 21 Active

    clsParent:

    using Countdown;
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace C_Sharp_Tests
    {
    internal class clsParent : INotifyPropertyChanged
    {
    public event PropertyChangedEventHandler PropertyChanged;

        private ItemObservableCollection \_MyChildren;
    
        public clsParent()
        {
            \_MyChildren = new ItemObservableCollection();
            this.\_MyChildren.ItemPropertyChanged += delegate (object sender, PropertyChangedEventArgs e)
            {
                if (string.Equals("IsChanged", e.PropertyName, StringComparison.Ordinal))
                {
                    this.RaisePropertyChanged("IsChanged");
                }
            };
        }
    }
    

    }

    clsChild:

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace C_Sharp_Tests
    {
    internal class clsChild : INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;
    
        public string name { get; set; }
    
    
    }
    

    }

    ItemObservableCollection:

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Countdown
    {
    /// /// You can use it like this:
    /// var orders = new ItemObservableCollection();
    /// orders.CollectionChanged += OnOrdersChanged;
    /// orders.ItemPropertyChanged += OnOrderChanged;
    ///
    /// The type
    public sealed class ItemObservableCollection

    L 1 Reply Last reply
    0
    • R rex64

      I have an ItemObservableCollection called _MyChildren with a collection of clsChild. I am trying to get nonfictions when a clsChild.name string is changed. Error I am getting on MyChildren.ItemPropertyChanged:

      Severity Code Description Project File Line Suppression State
      Error CS1661 Cannot convert anonymous method to type 'EventHandler>' because the parameter types do not match the delegate parameter types C-Sharp-Tests C:\Users\Jeff\Documents\GitHub\C-Sharp-Tests\C-Sharp-Tests\C-Sharp-Tests\clsParent.cs 21 Active

      clsParent:

      using Countdown;
      using System;
      using System.Collections.Generic;
      using System.Collections.ObjectModel;
      using System.ComponentModel;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;

      namespace C_Sharp_Tests
      {
      internal class clsParent : INotifyPropertyChanged
      {
      public event PropertyChangedEventHandler PropertyChanged;

          private ItemObservableCollection \_MyChildren;
      
          public clsParent()
          {
              \_MyChildren = new ItemObservableCollection();
              this.\_MyChildren.ItemPropertyChanged += delegate (object sender, PropertyChangedEventArgs e)
              {
                  if (string.Equals("IsChanged", e.PropertyName, StringComparison.Ordinal))
                  {
                      this.RaisePropertyChanged("IsChanged");
                  }
              };
          }
      }
      

      }

      clsChild:

      using System;
      using System.Collections.Generic;
      using System.Collections.ObjectModel;
      using System.ComponentModel;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;

      namespace C_Sharp_Tests
      {
      internal class clsChild : INotifyPropertyChanged
      {

          public event PropertyChangedEventHandler PropertyChanged;
      
          public string name { get; set; }
      
      
      }
      

      }

      ItemObservableCollection:

      using System;
      using System.Collections.Generic;
      using System.Collections.ObjectModel;
      using System.ComponentModel;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;

      namespace Countdown
      {
      /// /// You can use it like this:
      /// var orders = new ItemObservableCollection();
      /// orders.CollectionChanged += OnOrdersChanged;
      /// orders.ItemPropertyChanged += OnOrderChanged;
      ///
      /// The type
      public sealed class ItemObservableCollection

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I don't see why you just didn't stick with ObservableCollection. It's concurrent for read only. You simply "subscribe / unsubscribe". As if you can predict what properties to refresh on the client side.

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups