// Initialize the ResizingAdorner.
        public ScatterResizeAdorner(FrameworkElement adornedElement, ScatterViewItem scatterViewItem)
            : base(adornedElement)
        {
            svi = scatterViewItem;

            this.adornedElement = adornedElement;
            visualChildren      = new VisualCollection(this);

            BuildAdornerCornerRotate(ref rotate, Cursors.Hand);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);

            // Add handlers for resizing.
            bottomLeft.DragDelta  += new DragDeltaEventHandler(HandleBottomLeft);
            bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            topLeft.DragDelta     += new DragDeltaEventHandler(HandleTopLeft);
            topRight.DragDelta    += new DragDeltaEventHandler(HandleTopRight);

            rotate.DragDelta += new DragDeltaEventHandler(HandleRotate);
        }
        // Initialize the ResizingAdorner.
        public ScatterResizeAdorner(FrameworkElement adornedElement, ScatterViewItem scatterViewItem)
            : base(adornedElement)
        {
            svi = scatterViewItem;

            this.adornedElement = adornedElement;
            visualChildren = new VisualCollection(this);

            BuildAdornerCornerRotate(ref rotate, Cursors.Hand);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);

            // Add handlers for resizing.
            bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
            bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
            topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);

            rotate.DragDelta += new DragDeltaEventHandler(HandleRotate);
        }
示例#3
0
        private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ScatterViewItem container      = d as ScatterViewItem;
            bool            newValue       = (bool)e.NewValue;
            ScatterView     parentSelector = container._parent;

            if (newValue)
            {
                parentSelector.SetSelectedItem(container, true);
                container.RaiseEvent(new RoutedEventArgs(Selector.SelectedEvent, container));
                container.OnSelected();
            }
            else
            {
                parentSelector.SetSelectedItem(container, false);
                container.RaiseEvent(new RoutedEventArgs(Selector.UnselectedEvent, container));
                container.OnUnSelected();
            }
        }
        internal void SetSelectedItem(ScatterViewItem item, bool value)
        {
            if (SelectedItem != null)
            {
                if (SelectedItem is DependencyObject)
                {
                    SetIsSelected((DependencyObject)SelectedItem, false);
                    ScatterViewItem.SetIsSelected((DependencyObject)SelectedItem, false);
                }
                else
                {
                    DependencyObject dp = ItemContainerGenerator.ContainerFromItem(SelectedItem);

                    SetIsSelected(dp, false);
                    ScatterViewItem.SetIsSelected(dp, false);
                }
            }

            SetIsSelected(item , value);
        }
示例#5
0
        internal void SetSelectedItem(ScatterViewItem item, bool value)
        {
            if (SelectedItem != null)
            {
                if (SelectedItem is DependencyObject)
                {
                    SetIsSelected((DependencyObject)SelectedItem, false);
                    ScatterViewItem.SetIsSelected((DependencyObject)SelectedItem, false);
                }
                else
                {
                    DependencyObject dp = ItemContainerGenerator.ContainerFromItem(SelectedItem);

                    SetIsSelected(dp, false);
                    ScatterViewItem.SetIsSelected(dp, false);
                }
            }

            SetIsSelected(item, value);
        }