Skip to content

WindowStartupLocation = WindowStartupLocation.CenterOwner does not work on multiple displays #186

Open
@digitaldias

Description

I have two screens, and if I move my app to the secondary screen and run this:

    private async Task<bool> GetUserConfirmation(string title, string message)
    {
        return await Dispatcher.UIThread.InvokeAsync(async () =>
        {
            var dialog = MessageBoxManager.GetMessageBoxStandard(new MessageBoxStandardParams
            {
                ButtonDefinitions = MsBox.Avalonia.Enums.ButtonEnum.YesNo,
                ContentTitle = title,
                ContentMessage = message,
                Icon = MsBox.Avalonia.Enums.Icon.Question,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                EscDefaultButton = MsBox.Avalonia.Enums.ClickEnum.Ok,
            });

            var buttonPressed = await dialog.ShowWindowDialogAsync(_parentWindow);
            return buttonPressed == MsBox.Avalonia.Enums.ButtonResult.Yes;
        });
    }

The dialog will appear between my two displays. I can't get a window for it either, so I can't fix it unless you have a good way to grab the Window component of this dialog by a nice cast.

Edit:
I realize that I may be doing something wrong, too, but It'd be nice to know.
Here is a picture of how it looks on my second display. It is fine and centered on my primary display.
image

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions