Blacker.MangaScraper.Helpers.ListBoxExtension.OnListBoxSelectionChanged C# (CSharp) Method

OnListBoxSelectionChanged() private static method

private static OnListBoxSelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void
sender object
e System.Windows.Controls.SelectionChangedEventArgs
return void
        private static void OnListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox listBox = sender as ListBox; if (listBox != null)
            {

                //BindingExpression bexp = listBox.GetBindingExpression(SelectedItemsSourceProperty);

                //bexp.UpdateSource();
                bool isResynching = (bool)listBox.GetValue(IsResynchingPropertyKey.DependencyProperty);

                if (isResynching)
                    return;

                IList list = GetSelectedItemsSource(listBox);
                if (list != null)
                {
                    foreach (object obj in e.RemovedItems)
                    {
                        if (list.Contains(obj))
                            list.Remove(obj);
                    }
                    foreach (object obj in e.AddedItems)
                    {
                        if (!list.Contains(obj))
                            list.Add(obj);
                    }
                }
            }
        }