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