Unplanned
Last Updated: 15 Jun 2026 11:05 by Martin Ivanov
Add an option to disable the automatic popup element re-positioning when the callout is near the screen edge
Unplanned
Last Updated: 28 Mar 2024 10:33 by Martin Ivanov

The CanPopupExceedScreen=true setting is not taken into account when the parent window is moved. In that case if the popup reaches the edge of the screen, it will reposition so it doesn't go outside of it. This is the default behavior and setting CanPopupExceedScreen=true should disable it. 

To work this around, you can override the OnLocationChanged method of the hosting window and invoke the private ForcePopupPosition method of CalloutPopupService, using a reflection.

 protected override void OnLocationChanged(EventArgs e)
  {
      var popup = this.callout.ParentOfType<Popup>();
      if (popup != null && popup.IsOpen)
      {
          var methodInfo = typeof(CalloutPopupService).GetMethod("ForcePopupPosition", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
          methodInfo.Invoke(null, new object[1] { popup });
      }
  }