Inheritance: System.Windows.Controls.UserControl
Esempio n. 1
0
        public HoldCardInteraction(DragImage draggedImage, ItemsControl context, ScrollViewer scrollViewer)
        {
            _draggedImage = draggedImage;
            _context = context;
            _scrollViewer = scrollViewer;

            IsEnabled = true;
        }
Esempio 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();
            };
        }
Esempio n. 3
0
        private static void PopoutCard(UIElement element, DragImage image, Point relativePosition)
        {
            // Copy the selected card into a bitmap for use as the movement target
            var bitmap = new WriteableBitmap(element, null);
            image.Image.Source = bitmap;
            image.Visibility = Visibility.Visible;
            image.Opacity = 1.0;

            // this needs to be relative to the scrolled position
            image.SetVerticalOffset(relativePosition.Y);
            //image.SetHorizontalOffset(relativePosition.X);

            // hide the underlying item
            element.Opacity = 0.0;
        }