Beispiel #1
0
        public void Open(Point point, Rect rect)
        {
            this.rect = rect;
            switch (this.ArrowPlacement)
            {
                case Dock.Left:
                    this.PathPoint3.set_Size(new Size(this.CornerRadius.get_TopLeft(), this.CornerRadius.get_TopLeft()));
                    this.PathPoint5.set_Size(new Size(this.CornerRadius.get_TopRight(), this.CornerRadius.get_TopRight()));
                    this.PathPoint7.set_Size(new Size(this.CornerRadius.get_BottomRight(), this.CornerRadius.get_BottomRight()));
                    this.PathPoint9.set_Size(new Size(this.CornerRadius.get_BottomLeft(), this.CornerRadius.get_BottomLeft()));
                    this.RootPopup.set_HorizontalOffset(point.get_X() + this.HOriginOffset);
                    if ((this.RootPopup.get_HorizontalOffset() + base.get_Width()) <= rect.get_Width())
                    {
                        if (this.RootPopup.get_HorizontalOffset() < rect.get_Left())
                        {
                            this.RootPopup.set_HorizontalOffset(rect.get_Left());
                        }
                        break;
                    }
                    this.RootPopup.set_HorizontalOffset(rect.get_Width() - base.get_Width());
                    break;

                case Dock.Right:
                    this.PathPoint3.set_Size(new Size(this.CornerRadius.get_BottomRight(), this.CornerRadius.get_BottomRight()));
                    this.PathPoint5.set_Size(new Size(this.CornerRadius.get_BottomLeft(), this.CornerRadius.get_BottomLeft()));
                    this.PathPoint7.set_Size(new Size(this.CornerRadius.get_TopLeft(), this.CornerRadius.get_TopLeft()));
                    this.PathPoint9.set_Size(new Size(this.CornerRadius.get_TopRight(), this.CornerRadius.get_TopRight()));
                    this.RootPopup.set_HorizontalOffset((point.get_X() - this.HOriginOffset) - base.get_Width());
                    if ((this.RootPopup.get_HorizontalOffset() + base.get_Width()) <= rect.get_Width())
                    {
                        if (this.RootPopup.get_HorizontalOffset() < rect.get_Left())
                        {
                            this.RootPopup.set_HorizontalOffset(rect.get_Left());
                        }
                    }
                    else
                    {
                        this.RootPopup.set_HorizontalOffset(rect.get_Width() - base.get_Width());
                    }
                    this.RootPopup.set_VerticalOffset((point.get_Y() - base.get_Height()) + this.VOriginOffset);
                    if ((this.RootPopup.get_VerticalOffset() + base.get_Height()) > rect.get_Height())
                    {
                        this.RootPopup.set_VerticalOffset(rect.get_Height() - base.get_Height());
                    }
                    else if (this.RootPopup.get_VerticalOffset() < rect.get_Top())
                    {
                        this.RootPopup.set_VerticalOffset(rect.get_Top());
                    }
                    this.HOffsetAnimation.set_From(new double?(point.get_X()));
                    this.HOffsetAnimation.set_To(new double?(this.RootPopup.get_HorizontalOffset()));
                    this.VOffsetAnimation.set_From(new double?(point.get_Y()));
                    this.VOffsetAnimation.set_To(new double?(this.RootPopup.get_VerticalOffset()));
                    this.WidthAnimation.set_From(0.0);
                    this.WidthAnimation.set_To(new double?(base.get_Width()));
                    this.HeightAnimation.set_From(0.0);
                    this.HeightAnimation.set_To(new double?(base.get_Height()));
                    this.StartPointAnimation.set_From(new Point(0.0, 0.0));
                    this.StartPointAnimation.set_To(new Point(point.get_X() - this.RootPopup.get_HorizontalOffset(), point.get_Y() - this.RootPopup.get_VerticalOffset()));
                    this.PathPoint1Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint1Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (base.get_Height() / 2.0) + this.HalfArrowWidth));
                    this.PathPoint2Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint2Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (base.get_Height() + this.BorderWidth) - this.CornerRadius.get_BottomRight()));
                    this.PathPoint3Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint3Animation.set_To(new Point((base.get_Width() + this.BorderWidth) - this.CornerRadius.get_BottomRight(), base.get_Height() + this.BorderWidth));
                    this.PathPoint4Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint4Animation.set_To(new Point((-1.0 * this.BorderWidth) + this.CornerRadius.get_BottomLeft(), base.get_Height() + this.BorderWidth));
                    this.PathPoint5Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint5Animation.set_To(new Point(-1.0 * this.BorderWidth, (base.get_Height() + this.BorderWidth) - this.CornerRadius.get_BottomLeft()));
                    this.PathPoint6Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint6Animation.set_To(new Point(-1.0 * this.BorderWidth, (-1.0 * this.BorderWidth) + this.CornerRadius.get_TopLeft()));
                    this.PathPoint7Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint7Animation.set_To(new Point((-1.0 * this.BorderWidth) + this.CornerRadius.get_TopLeft(), -1.0 * this.BorderWidth));
                    this.PathPoint8Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint8Animation.set_To(new Point((base.get_Width() + this.BorderWidth) - this.CornerRadius.get_TopRight(), -1.0 * this.BorderWidth));
                    this.PathPoint9Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint9Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (-1.0 * this.BorderWidth) + this.CornerRadius.get_TopRight()));
                    this.PathPoint10Animation.set_From(new Point(0.0, 0.0));
                    this.PathPoint10Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (base.get_Height() / 2.0) - this.HalfArrowWidth));
                    goto Label_0DE2;

                default:
                    goto Label_0DE2;
            }
            this.RootPopup.set_VerticalOffset((point.get_Y() - base.get_Height()) + this.VOriginOffset);
            if ((this.RootPopup.get_VerticalOffset() + base.get_Height()) > rect.get_Height())
            {
                this.RootPopup.set_VerticalOffset(rect.get_Height() - base.get_Height());
            }
            else if (this.RootPopup.get_VerticalOffset() < rect.get_Top())
            {
                this.RootPopup.set_VerticalOffset(rect.get_Top());
            }
            this.HOffsetAnimation.set_From(new double?(point.get_X()));
            this.HOffsetAnimation.set_To(new double?(this.RootPopup.get_HorizontalOffset()));
            this.VOffsetAnimation.set_From(new double?(point.get_Y()));
            this.VOffsetAnimation.set_To(new double?(this.RootPopup.get_VerticalOffset()));
            this.WidthAnimation.set_From(0.0);
            this.WidthAnimation.set_To(new double?(base.get_Width()));
            this.HeightAnimation.set_From(0.0);
            this.HeightAnimation.set_To(new double?(base.get_Height()));
            this.StartPointAnimation.set_From(new Point(0.0, 0.0));
            this.StartPointAnimation.set_To(new Point(point.get_X() - this.RootPopup.get_HorizontalOffset(), point.get_Y() - this.RootPopup.get_VerticalOffset()));
            this.PathPoint1Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint1Animation.set_To(new Point(-1.0 * this.BorderWidth, (base.get_Height() / 2.0) - this.HalfArrowWidth));
            this.PathPoint2Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint2Animation.set_To(new Point(-1.0 * this.BorderWidth, (-1.0 * this.BorderWidth) + this.CornerRadius.get_TopLeft()));
            this.PathPoint3Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint3Animation.set_To(new Point((-1.0 * this.BorderWidth) + this.CornerRadius.get_TopLeft(), -1.0 * this.BorderWidth));
            this.PathPoint4Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint4Animation.set_To(new Point((base.get_Width() + this.BorderWidth) - this.CornerRadius.get_TopRight(), -1.0 * this.BorderWidth));
            this.PathPoint5Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint5Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (-1.0 * this.BorderWidth) + this.CornerRadius.get_TopRight()));
            this.PathPoint6Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint6Animation.set_To(new Point(base.get_Width() + this.BorderWidth, (base.get_Height() + this.BorderWidth) - this.CornerRadius.get_BottomRight()));
            this.PathPoint7Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint7Animation.set_To(new Point((base.get_Width() + this.BorderWidth) - this.CornerRadius.get_BottomRight(), base.get_Height() + this.BorderWidth));
            this.PathPoint8Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint8Animation.set_To(new Point((-1.0 * this.BorderWidth) + this.CornerRadius.get_BottomLeft(), base.get_Height() + this.BorderWidth));
            this.PathPoint9Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint9Animation.set_To(new Point(-1.0 * this.BorderWidth, (base.get_Height() + this.BorderWidth) - this.CornerRadius.get_BottomLeft()));
            this.PathPoint10Animation.set_From(new Point(0.0, 0.0));
            this.PathPoint10Animation.set_To(new Point(-1.0 * this.BorderWidth, (base.get_Height() / 2.0) + this.HalfArrowWidth));
            Label_0DE2:
            base.set_Width(0.0);
            base.set_Height(0.0);
            this.IsOpen = true;
            this.PopupStoryboard.Begin();
        }