Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Controlling the UltraPeekPopup location
posted

Hi! I am using UltraPeekPopup to display tooltips for my appointments. To show a tooltip on the right/left side of the owning element the UltraPeekPopup.Open() method is called with PeekLocation.RightOfItem parameter.

If there is enough space on the right/left side of the owning element the Peek displayed correctly. But in some cases, when there is not enough space to show the Peek on the right/left side of the owning element the UltraPeekPopup.Open() method shows only part of the Peek caption and content.

Is there any way to probe the Peek size before it displayed?

I tried to use PeekLocation.Default parameter of the UltraPeekPopup.Open() method to control a location of the Peek, but it chooses any appropriate location, that does not always looks good.

Kind regards,

  • 6158
    Verified Answer
    Offline posted

    Hello Victor,

    The UltraPeekPopup component internally uses the PeekControl defined in our Win assembly to display the peek window. Unfortunately, the size is not calculated until you begin the show action or explicitly set the PeekControl's PeekOwner property. However to get the size, by using a temporary PeekControl, you can as assign the UltraPeekPopup component to the PeekOwner property on the PeekControl, and then access the Size property on the PeekControl. Code like the following should work:

            private Size GetPeekSize(IPeekOwner peekOwner)
            {
                // Pass the UltraPeekPopup component into this method
                using (var tempPeekControl = new Infragistics.Win.Peek.PeekControl())
                {
                    tempPeekControl.PeekOwner = peekOwner;
                    Size size = tempPeekControl.Size;
                    tempPeekControl.PeekOwner = null;
                    return size;
                }
            }

    More of a concern to me, is the content and caption being cut off. The UltraPeekPopup is designed so that if there is not enough screen space on the requested side of the exclusion rectangle (obtained via the UIElement in your case), it will display the Peek on the opposite size of the exclusion rectangle. If there isn't enough screen space on the requested side, is there enough space on the opposite side?

    Thanks

    Chris