private void InitMoreInfoContentContainer(GridViewItem container)
        {
            if (MoreInfoContent == null)
            {
                return;
            }

            var point = container.TransformToVisual(this).TransformPoint(new Windows.Foundation.Point(0, 0));
            var x     = point.X - ((MoreInfoContent.Width - container.ActualWidth) / 2);
            var y     = point.Y - ((MoreInfoContent.Height - container.ActualHeight) / 2);

            x = Math.Max(x, 10);
            x = Math.Min(x, ActualWidth - MoreInfoContent.Width - 10);

            y = Math.Max(y, 10);
            y = Math.Min(y, ActualHeight - MoreInfoContent.Height - 10);

            Canvas.SetLeft(MoreInfoContent, x);
            Canvas.SetTop(MoreInfoContent, y);

            var centerX = (point.X + (container.ActualWidth / 2)) - x;
            var centerY = (point.Y + (container.ActualHeight / 2)) - y;

            VisualExtensions.SetCenterPoint(MoreInfoContent, new Vector3((float)centerX, (float)centerY, 0).ToString());
        }
示例#2
0
        private Vector3 GetCenterPoint(GridViewItem itemcontainer, double itemsize)
        {
            var   ttv          = itemcontainer.TransformToVisual(Window.Current.Content);
            Point screenCoords = ttv.TransformPoint(new Point(0, 0));

            if (screenCoords.X < ActualWidth / 2)
            {
                return(new Vector3((float)itemsize, (float)itemsize, 0));
            }
            else
            {
                return(new Vector3(0, (float)itemsize, 0));
            }
        }
示例#3
0
        private Vector3 GetCenterPoint2(GridViewItem itemcontainer, double itemsize)
        {
            var   ttv          = itemcontainer.TransformToVisual(Window.Current.Content);
            Point screenCoords = ttv.TransformPoint(new Point(0, 0));

            double width     = ActualWidth;
            double itemX     = screenCoords.X;
            double itemWidth = itemsize;

            double percentage = width / itemX;

            double percentageValue = itemsize / percentage;

            //Debug.WriteLine("---------------------------");
            //Debug.WriteLine("ITEMX: " + itemX);
            //Debug.WriteLine("itemWidth:" + itemsize);
            //Debug.WriteLine("percentage: " + percentage);
            //Debug.WriteLine("percentageValue: " + percentageValue);
            //Debug.WriteLine("center point: " + (itemsize - percentageValue));
            //Debug.WriteLine("---------------------------");

            return(new Vector3((float)(itemsize - percentageValue), (float)itemsize, 0));
        }