Пример #1
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            if (sv.IsMouseOver)
            {
                tile = null;

                // Save starting point, used later when determining how much to scroll.
                scrollStartPoint    = e.GetPosition(this);
                scrollStartOffset.X = sv.HorizontalOffset;
                scrollStartOffset.Y = sv.VerticalOffset;

                // Update the cursor if can scroll or not.
                Cursor = (sv.ExtentWidth > sv.ViewportWidth) || (sv.ExtentHeight > sv.ViewportHeight) ? Cursors.ScrollAll : Cursors.Arrow;

                //store Control if one was found, so we can call its command later
                var x = TreeHelper.TryFindFromPoint <ListBoxItem>(this, scrollStartPoint);
                if (x != null)
                {
                    x.IsSelected = !x.IsSelected;
                    ItemsControl tiles = ItemsControlFromItemContainer(x);
                    var          data  = tiles.ItemContainerGenerator.ItemFromContainer(x);
                    if (data != null && data is IPanoramaTile)
                    {
                        tile = (IPanoramaTile)data;
                    }
                }
            }

            base.OnPreviewMouseDown(e);
        }
Пример #2
0
        protected override void OnPreviewTouchDown(TouchEventArgs e)
        {
            currentTouchPoint = e.GetTouchPoint(this);

            tile = null;

            // Save starting point, used later when determining how much to scroll.
            scrollTouchStartPoint = e.GetTouchPoint(this);
            scrollStartOffset.X   = sv.HorizontalOffset;
            scrollStartOffset.Y   = sv.VerticalOffset;

            scrollStartPoint.X = scrollTouchStartPoint.Position.X;
            scrollStartPoint.Y = scrollTouchStartPoint.Position.Y;

            //store Control if one was found, so we can call its command later
            var x = TreeHelper.TryFindFromPoint <ListBoxItem>(this, scrollStartPoint);

            if (x != null)
            {
                x.IsSelected = true;
                ItemsControl tiles = ItemsControl.ItemsControlFromItemContainer(x);
                var          data  = tiles.ItemContainerGenerator.ItemFromContainer(x);
                if (data != null && data is IPanoramaTile)
                {
                    tile = (IPanoramaTile)data;
                    // JH Start - See IPanoramaTile for justification
                    tile.IsPressed = true;
                    // JH End - See IPanoramaTile for justification
                }
            }

            //this.CaptureTouch(TouchesCaptured.First<TouchDevice>());

            base.OnPreviewTouchDown(e);
        }
Пример #3
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            //if (sv.IsMouseOver)
            // JH Start - Belt & braces...
            if (sv.IsMouseOver && e.ChangedButton == MouseButton.Left)
            // JH End - Belt & braces...
            {
                tile = null;

                // Save starting point, used later when determining how much to scroll.
                scrollStartPoint    = e.GetPosition(this);
                scrollStartOffset.X = sv.HorizontalOffset;
                scrollStartOffset.Y = sv.VerticalOffset;

                // JH Start - update cursor only once we move
                // Update the cursor if can scroll or not.
                //this.Cursor = (sv.ExtentWidth > sv.ViewportWidth) ||
                //    (sv.ExtentHeight > sv.ViewportHeight) ?
                //    Cursors.ScrollAll : Cursors.Arrow;
                // JH End - update cursor only once we move

                //store Control if one was found, so we can call its command later
                var x = TreeHelper.TryFindFromPoint <ListBoxItem>(this, scrollStartPoint);
                if (x != null)
                {
                    x.IsSelected = true;
                    ItemsControl tiles = ItemsControl.ItemsControlFromItemContainer(x);
                    var          data  = tiles.ItemContainerGenerator.ItemFromContainer(x);
                    if (data != null && data is IPanoramaTile)
                    {
                        tile = (IPanoramaTile)data;
                        // JH Start - See IPanoramaTile for justification
                        tile.IsPressed = true;
                        // JH End - See IPanoramaTile for justification
                    }
                }

                this.CaptureMouse();
            }

            base.OnPreviewMouseDown(e);
        }
Пример #4
0
        private void HandleMouseDown()
        {
            tile = null;

            scrollStartOffset.X = sv.HorizontalOffset;
            scrollStartOffset.Y = sv.VerticalOffset;

            //store Control if one was found, so we can call its command later
            var x = TreeHelper.TryFindFromPoint <ListBoxItem>(this, scrollStartPoint);

            if (x != null)
            {
                x.IsSelected = !x.IsSelected;
                ItemsControl tiles = ItemsControlFromItemContainer(x);
                var          data  = tiles.ItemContainerGenerator.ItemFromContainer(x);
                if (data != null && data is IPanoramaTile)
                {
                    tile = (IPanoramaTile)data;
                }
            }
        }
Пример #5
0
        private void HandleMouseDown()
        {
            tile = null;

            scrollStartOffset.X = sv.HorizontalOffset;
            scrollStartOffset.Y = sv.VerticalOffset;

            //store Control if one was found, so we can call its command later
            var x = TreeHelper.TryFindFromPoint<ListBoxItem>(this, scrollStartPoint);
            if (x != null)
            {
                x.IsSelected = !x.IsSelected;
                ItemsControl tiles = ItemsControlFromItemContainer(x);
                var data = tiles.ItemContainerGenerator.ItemFromContainer(x);
                if (data != null && data is IPanoramaTile)
                {
                    tile = (IPanoramaTile)data;
                }
            }
        }
Пример #6
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            if (sv.IsMouseOver)
            {
                tile = null;

                // Save starting point, used later when determining how much to scroll.
                scrollStartPoint = e.GetPosition(this);
                scrollStartOffset.X = sv.HorizontalOffset;
                scrollStartOffset.Y = sv.VerticalOffset;

                // Update the cursor if can scroll or not.
                Cursor = (sv.ExtentWidth > sv.ViewportWidth) || (sv.ExtentHeight > sv.ViewportHeight) ? Cursors.ScrollAll : Cursors.Arrow;

                //store Control if one was found, so we can call its command later
                var x = TreeHelper.TryFindFromPoint<ListBoxItem>(this, scrollStartPoint);
                if (x != null)
                {
                    x.IsSelected = true;
                    ItemsControl tiles = ItemsControlFromItemContainer(x);
                    var data = tiles.ItemContainerGenerator.ItemFromContainer(x);
                    if (data != null && data is IPanoramaTile)
                    {
                        tile = (IPanoramaTile)data;
                    }
                }

                CaptureMouse();
            }

            base.OnPreviewMouseDown(e);
        }
Пример #7
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            //if (sv.IsMouseOver)
			// JH Start - Belt & braces...
			if (sv.IsMouseOver && e.ChangedButton == MouseButton.Left)
			// JH End - Belt & braces...
			{
                tile = null;

                // Save starting point, used later when determining how much to scroll.
                scrollStartPoint = e.GetPosition(this);
                scrollStartOffset.X = sv.HorizontalOffset;
                scrollStartOffset.Y = sv.VerticalOffset;

				// JH Start - update cursor only once we move
                // Update the cursor if can scroll or not.
				//this.Cursor = (sv.ExtentWidth > sv.ViewportWidth) ||
				//    (sv.ExtentHeight > sv.ViewportHeight) ?
				//    Cursors.ScrollAll : Cursors.Arrow;
				// JH End - update cursor only once we move

                //store Control if one was found, so we can call its command later
                var x = TreeHelper.TryFindFromPoint<ListBoxItem>(this, scrollStartPoint);
                if (x != null)
                {
                    x.IsSelected = true;
                    ItemsControl tiles = ItemsControl.ItemsControlFromItemContainer(x);
                    var data = tiles.ItemContainerGenerator.ItemFromContainer(x);
                    if (data != null && data is IPanoramaTile)
                    {
                        tile = (IPanoramaTile)data;
						// JH Start - See IPanoramaTile for justification
						tile.IsPressed = true;
						// JH End - See IPanoramaTile for justification
					}
                }

                this.CaptureMouse();
            }

            base.OnPreviewMouseDown(e);
        }
Пример #8
0
        protected override void OnPreviewTouchDown(TouchEventArgs e)
        {
            currentTouchPoint = e.GetTouchPoint(this);

            tile = null;

            // Save starting point, used later when determining how much to scroll.
            scrollTouchStartPoint = e.GetTouchPoint(this);
            scrollStartOffset.X = sv.HorizontalOffset;
            scrollStartOffset.Y = sv.VerticalOffset;

            scrollStartPoint.X = scrollTouchStartPoint.Position.X;
            scrollStartPoint.Y = scrollTouchStartPoint.Position.Y;

            //store Control if one was found, so we can call its command later
            var x = TreeHelper.TryFindFromPoint<ListBoxItem>(this, scrollStartPoint);
            if (x != null)
            {
                x.IsSelected = true;
                ItemsControl tiles = ItemsControl.ItemsControlFromItemContainer(x);
                var data = tiles.ItemContainerGenerator.ItemFromContainer(x);
                if (data != null && data is IPanoramaTile)
                {
                    tile = (IPanoramaTile)data;
                    // JH Start - See IPanoramaTile for justification
                    tile.IsPressed = true;
                    // JH End - See IPanoramaTile for justification
                }
            }

            //this.CaptureTouch(TouchesCaptured.First<TouchDevice>()); 

            base.OnPreviewTouchDown(e);
        }