Unplanned
Last Updated: 28 Mar 2024 10:33 by Martin Ivanov
Martin Ivanov
Created on: 28 Mar 2024 10:33
Category: Callout
Type: Bug Report
0
Callout: Setting CanPopupExceedScreen of CalloutPopupSettings to true works only initially

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 });
      }
  }

0 comments