BindableApplicationBar.BindableApplicationBar.ButtonsCollectionChanged C# (CSharp) Méthode

ButtonsCollectionChanged() private méthode

private ButtonsCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void
sender object
e System.Collections.Specialized.NotifyCollectionChangedEventArgs
Résultat void
        private void ButtonsCollectionChanged(
            object sender, NotifyCollectionChangedEventArgs e)
        {
            if (this.applicationBar == null)
            {
                return;
            }

            if (e.OldItems != null)
            {
                foreach (var oldItem in e.OldItems)
                {
                    this.DetachButton((BindableApplicationBarButton)oldItem);
                }
            }

            if (e.NewItems != null)
            {
                int i = 0;

                foreach (var newItem in e.NewItems)
                {
                    this.AttachButton(
                        (BindableApplicationBarButton)newItem,
                        e.NewStartingIndex + i++);
                }
            }
        }
        #endregion