void delegater_Bound(object sender, BindingEventArgs e) { Type itemType = e.Behavior.GetType(); if (itemType.IsSubclassOf(TypeToCatch) || itemType.Equals(TypeToCatch)) { Add((T)e.Behavior); } }
void delegater_Unbound(object sender, BindingEventArgs e) { if (e.Behavior is T) { if (items.Contains((T)e.Behavior)) { Remove((T)e.Behavior); } } }