Ejemplo n.º 1
0
        void CarElementMouseEnter(object sender, MouseEventArgs e)
        {
            CarElement         = (controlCarInfo)sender;
            CarElementPosition = CarElement.GetPosition(layoutCars);

            var carDetailsElement = new controlCarInfo(true, true, true);

            carDetailsElement.DataContext   = CarElement.DataContext;
            carDetailsElement.FlowDirection = CarElement.FlowDirection;
            carDetailsElement.FontFamily    = CarElement.FontFamily;
            carDetailsElement.Owner         = CarElement;

            CarDetailsPopup                 = new TransparentPopup();
            CarDetailsPopup.Child           = carDetailsElement;
            CarDetailsPopup.PlacementTarget = layoutCars;
            CarDetailsPopup.IsOpen          = true;
            carDetailsElement.UpdateLayout();
            if (CarDetailsPopup == null)
            {
                return;
            }
            Point carDetailsPopupPosition =
                PointHelper.Subtract(PointHelper.Add(CarElementPosition, CarElement.ContentOffset), carDetailsElement.ContentOffset);

            CarDetailsPopup.HorizontalOffset = carDetailsPopupPosition.X;
            CarDetailsPopup.VerticalOffset   = carDetailsPopupPosition.Y;
            CarDetailsPopup.MakeVisible();

            Storyboard.SetTarget(CarDetailsShowingAnimation, carDetailsElement);
            CarDetailsShowingAnimation.Begin();
        }
Ejemplo n.º 2
0
        void CarElementMouseLeave(object sender, MouseEventArgs e)
        {
            if (CarDetailsPopup == null)
            {
                return;
            }
            CarDetailsShowingAnimation.Stop();

            CarDetailsPopup.IsOpen = false;
            CarDetailsPopup.Child  = null;
            CarDetailsPopup        = null;

            CarElement = null;
        }