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,
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
Hi Chris,
The provided method GetPeekSize(IPeekOwner peekOwner) is working for me and by using this method I was able to calculate proper location for the peek window.
Thank you.