ItemObservableCollection
-
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 ActiveclsParent:
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 -
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 ActiveclsParent:
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 ItemObservableCollectionI 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