Пример #1
0
        private void InitializeDisplayPresenterElement()
        {
            if (DisplayPresenterElement == null)
            {
                return;
            }

            DisplayPresenterElement.AddHandler(ContentPresenter.MouseLeftButtonDownEvent,
                                               new RoutedEventHandler(DisplayPresenter_LeftDown));
        }
Пример #2
0
        private void CalculatePopUpPosition()
        {
            if (PopUpElement == null || !PopUpElement.IsOpen || PopUpContainerElement == null || DisplayPresenterElement == null)
            {
                return;
            }

            var displayPosition = DisplayPresenterElement.PointToScreen(new Point(0, 0));
            var popUpSize       = new Size(PopUpContainerElement.ActualWidth, PopUpPresenterElement.ActualHeight);
            var displaySize     = new Size(DisplayPresenterElement.ActualWidth, DisplayPresenterElement.ActualHeight);

            if (CalculateRectangle != null)
            {
                PopUpElement.PlacementRectangle = CalculateRectangle(displayPosition, popUpSize, displaySize);
            }
        }