UserPromptBuilder no longer blocks parent window after upgrade to 24.2

Fundamentals for Avalonia Forum

Posted 7 months ago by Pavel Pokorný
Avatar

Hi,

after upgrading to Avalonia 11.1.1 together with Actipro Fundamentals 24.2, UserPrompBuilder dialogs don't prevent interaction with parent window.

I have verified this problem in Samples application.

Avalonia 11.0.11 and 24.1 works correctly.

Comments (1)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Pavel,

Thank you for reporting this issue. It appears there was a change in how Avalonia handles Window.ShowDialog(owner) if the Window.Owner property is already set.  We will have this fixed for the next release.

The solution is to not set Window.Owner before calling ShowDialog. The WindowBase.Owner property setter is protected, so the workaround requires the use of reflection to set the property.  If you place the following in your application startup (like App.Initialize method), this should clear the Owner property and allow the ShowDialog method to work as expected until our fix is available.

UserPromptBuilder.RegisterGlobalConfigureCallback(builder => builder.AfterInitializeWindow(window => {
    // HACK: Temporary workaround to allow modal user prompts until it is fixed in Actipro Avalonia Controls v24.2.1
    typeof(WindowBase).GetProperty(nameof(WindowBase.Owner))?.SetValue(window, null);
}));


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.