Esempio n. 1
0
        protected override void OnListChanged(ListChangedEventArgs e)
        {
            if (e.ListChangedType == ListChangedType.Reset)
            {
                if (Filter == null || Filter == "")
                {
                    AllowNew = true;
                }
                else
                {
                    AllowNew = false;
                }
            }

            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                OriginalList.Add(this[e.NewIndex]);
                if (!String.IsNullOrEmpty(Filter))
                {
                    string cachedFilter = this.Filter;
                    this.Filter = "";
                    this.Filter = cachedFilter;
                }
            }
            if (e.ListChangedType == ListChangedType.ItemDeleted)
            {
                OriginalList.RemoveAt(e.NewIndex);
            }

            base.OnListChanged(e);
        }
Esempio n. 2
0
        protected override void OnListChanged(ListChangedEventArgs e)
        {
            // If the list is reset, check for a filter. If a filter
            // is applied don't allow items to be added to the list.
            if (e.ListChangedType == ListChangedType.Reset)
            {
                if (Filter == null || Filter == "")
                {
                    AllowNew = true;
                }
                else
                {
                    AllowNew = false;
                }
            }
            // Add the new item to the original list.
            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                OriginalList.Add(this[e.NewIndex]);
                if (!String.IsNullOrEmpty(Filter))
                //if (Filter == null || Filter == "")
                {
                    string cachedFilter = this.Filter;
                    this.Filter = "";
                    this.Filter = cachedFilter;
                }
            }
            // Remove the new item from the original list.
            if (e.ListChangedType == ListChangedType.ItemDeleted)
            {
                OriginalList.RemoveAt(e.NewIndex);
            }

            base.OnListChanged(e);
        }
        protected override void OnListChanged(ListChangedEventArgs e)
        {
            // If the list is reset, check for a filter. If a filter
            // is applied, don't allow items to be added to the list.
            if (e.ListChangedType == ListChangedType.Reset)
            {
                AllowNew = string.IsNullOrEmpty(Filter);
            }
            // Add the new item to the original list.
            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                OriginalList.Add(this[e.NewIndex]);
                if (!string.IsNullOrEmpty(Filter))
                {
                    var cachedFilter = Filter;
                    Filter = string.Empty;
                    Filter = cachedFilter;
                }
            }
            // Remove the new item from the original list.
            if (e.ListChangedType == ListChangedType.ItemDeleted)
            {
                OriginalList.RemoveAt(e.NewIndex);
            }

            base.OnListChanged(e);
        }
Esempio n. 4
0
 public void RemoveAt(int index)
 {
     NewList.RemoveAt(index);
     OriginalList.RemoveAt(index);
 }