If your DM_SDLSchedule class implements INotifyPropertyChanged, all should work. Please,
post here DM_SDLSchedule class definition, or send me your solution to
IrinaP at componentone.com if possible. I'll take a look.
--
Thanks,
--
Irina
???????/???????? ? ???????? ?????????: news:206657@10.0.1.98...
> Again, i bound it to IBindingList, Add, Remove are OK, UI refresh data, but it doesn't
> work when edit an appointment. After i call IBindingList.ItemChanged(item), nothing
> happens. What i need to do for Edit case. Here is my IBindingList implementation:
>
> I also implemented INotifyPropertyChanged but helpless.
>
> using System;
>
> using System.ComponentModel;
>
> using System.Collections;
>
> using System.Collections.Generic;
>
> using System.Collections.ObjectModel;
>
> using System.Text;
>
> using UDx.G8H.AppSvc.DataModel;namespace UDx.G8H.SmartClients.Office
>
> {
>
> publicclassSDLScheduleBindingList: CollectionBase, IBindingList
>
> {privateListChangedEventArgs resetEvent =
> newListChangedEventArgs(ListChangedType.Reset, -1);
>
> privateListChangedEventHandler onListChanged;publicvoid LoadList(List
> ListSource)
>
> {IList l = (IList)this;foreach(DM_SDLSchedule _one in ListSource) l.Add(_one);
>
> OnListChanged(resetEvent);
>
> }publicDM_SDLSchedulethis[int index]
>
> {get { return (DM_SDLSchedule)(List[index]); }set { List[index] = value; }
>
> }publicint Add (DM_SDLSchedule value)
>
> {return List.Add(value);
>
> }publicDM_SDLSchedule AddNew()
>
> {return (DM_SDLSchedule)((IBindingList)this).AddNew();
>
> }publicvoid Remove (DM_SDLSchedule value)
>
> {
>
> List.Remove(value);
>
> }protectedvirtualvoid OnListChanged(ListChangedEventArgs ev)
>
> {if (onListChanged != null) {onListChanged(this, ev);
>
> }
>
> }protectedoverridevoid OnClear()
>
> {
>
> //
>
> }protectedoverridevoid OnClearComplete()
>
> {
>
> OnListChanged(resetEvent);
>
> }protectedoverridevoid OnInsertComplete(int index, object value)
>
> {DM_SDLSchedule c =
> (DM_SDLSchedule)value;OnListChanged(newListChangedEventArgs(ListChangedType.ItemAdded,
> index));
>
> }protectedoverridevoid OnRemoveComplete(int index, object value)
>
> {
>
> DM_SDLSchedule c =
> (DM_SDLSchedule)value;OnListChanged(newListChangedEventArgs(ListChangedType.ItemDeleted,
> index));
>
> }protectedoverridevoid OnSetComplete(int index, object oldValue, object newValue)
>
> {if (oldValue != newValue) {
>
> DM_SDLSchedule olditem = (DM_SDLSchedule)oldValue;DM_SDLSchedule newitem =
> (DM_SDLSchedule)newValue;OnListChanged(newListChangedEventArgs(ListChangedType.ItemAdded,
> index));
>
> }
>
> }
>
> // Called by item when it changes.internalvoid ItemChanged(DM_SDLSchedule item)
>
> {int index =
> List.IndexOf(item);OnListChanged(newListChangedEventArgs(ListChangedType.ItemChanged,
> index));
>
> }
>
> // Implements IBindingList.boolIBindingList.AllowEdit
>
> { get { returntrue ; }
>
> }boolIBindingList.AllowNew
>
> { get { returntrue ; }
>
> }boolIBindingList.AllowRemove
>
> { get { returntrue ; }
>
> }boolIBindingList.SupportsChangeNotification
>
> { get { returntrue ; }
>
> }boolIBindingList.SupportsSearching
>
> { get { returnfalse ; }
>
> }boolIBindingList.SupportsSorting
>
> { get { returnfalse ; }
>
> }
>
> // Events.publiceventListChangedEventHandler ListChanged
>
> {add { onListChanged += value; }remove { onListChanged -= value; }
>
> }
>
> // Methods.objectIBindingList.AddNew()
>
> {DM_SDLSchedule c = newDM_SDLSchedule();
>
> List.Add(c);return c;
>
> }
>
> // Unsupported properties.boolIBindingList.IsSorted
>
> { get { thrownewNotSupportedException(); }
>
> }ListSortDirectionIBindingList.SortDirection
>
> { get { thrownewNotSupportedException(); }
>
> }PropertyDescriptorIBindingList.SortProperty
>
> { get { thrownewNotSupportedException(); }
>
> }
>
>
>
> // Unsupported Methods.voidIBindingList.AddIndex(PropertyDescriptor property)
>
> {thrownewNotSupportedException();
>
> }voidIBindingList.ApplySort(PropertyDescriptor property, ListSortDirection direction)
>
> {thrownewNotSupportedException();
>
> }intIBindingList.Find(PropertyDescriptor property, object key)
>
> {thrownewNotSupportedException();
>
> }voidIBindingList.RemoveIndex(PropertyDescriptor property)
>
> {thrownewNotSupportedException();
>
> }voidIBindingList.RemoveSort()
>
> {thrownewNotSupportedException();
>
> }
>
> }
>
>
>
> }
>