Silverlight: ListBox ItemsChanged event
February 23, 2009 2 Comments
Bits me why this is not implemented.
i was missing an event on the ListBox – ItemsChanged.
as you can see the implementation is so easy:
using System.Collections.Specialized;
...
public class ListBoxGeneric : ListBox
{
#region Constructor
public ListBoxGeneric() : base() { }
#endregion Constructor
#region Override
protected override void OnItemsChanged(
NotifyCollectionChangedEventArgs e)
{
base.OnItemsChanged(e);
OnItemsChangedEvent(e);
}
#endregion Override
#region Class Events
public delegate void ItemsChangedEventHandler(object sender,
NotifyCollectionChangedEventArgs e);
public event ItemsChangedEventHandler ItemsChanged;
private void OnItemsChangedEvent(
NotifyCollectionChangedEventArgs e)
{
if (ItemsChanged != null)
{
ItemsChanged(this, e);
}
}
#endregion Class Events
}

thanks buddy, just what I needed
Thank you! This really helped!