Exemplo n.º 1
0
        public DragVerticalInteraction(DragImage dragImage, ItemsControl itemsControl, ScrollViewer scrollViewer,
                                       IEventAggregator eventAggregator)
        {
            _dragImage = dragImage;
            _itemsControl = itemsControl;
            _eventAggregator = eventAggregator;
            _scrollViewer = scrollViewer;
            _cardsModel = (BindableCollection<CardViewModel>) itemsControl.ItemsSource;

            // This indexes the cards and their positions in the list
            // so that we can more readily determine how to visually reorganize
            _pointIndex = new PointIndex();

            // setup the timer that solves movement and card relations
            _dispatcherTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(50)};
            _dispatcherTimer.Tick += (sender, args) =>
            {
                AutoScrollLayout();
                ReorganizeLayout();
            };
        }
Exemplo n.º 2
0
        public DragVerticalInteraction(DragImage dragImage, ItemsControl itemsControl, ScrollViewer scrollViewer,
                                       IEventAggregator eventAggregator)
        {
            _dragImage       = dragImage;
            _itemsControl    = itemsControl;
            _eventAggregator = eventAggregator;
            _scrollViewer    = scrollViewer;
            _cardsModel      = (BindableCollection <CardViewModel>)itemsControl.ItemsSource;

            // This indexes the cards and their positions in the list
            // so that we can more readily determine how to visually reorganize
            _pointIndex = new PointIndex();

            // setup the timer that solves movement and card relations
            _dispatcherTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(50)
            };
            _dispatcherTimer.Tick += (sender, args) =>
            {
                AutoScrollLayout();
                ReorganizeLayout();
            };
        }