Beispiel #1
0
 public ListBox()
 {
     _swapRoot = new Node { Name = "Root" };
     _swapRoot.Children.Add(_swapA = new ListBoxItem { Name = "A" });
     _swapRoot.Children.Add(_swapB = new ListBoxItem { Name = "B" });
 }
Beispiel #2
0
        private void CheckSort()
        {
            for (int i = 1; i < _items.Count; i++)
            {
                _itemA = _items[i - 1];
                _itemB = _items[i];
                INode contentA = _itemA.Content;
                INode contentB = _itemB.Content;

                if (contentA != null && contentB != null && Comparer(contentA, contentB))
                {
                    _itemA.Content = null;
                    _itemB.Content = null;

                    _swapAnimation.Reset();
                    _swapAnimation.Play();

                    _swapA.Content = contentA;
                    _swapB.Content = contentB;

                    _swapRoot.Position = (_itemA.Position + _itemB.Position) * 0.5f;

                    Children.Add(_swapRoot);

                    IsSorting = true;

                    break;
                }
            }
        }