AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
228 stars 15 forks source link

AlignmentDialogPopupPositioner does not support Stretch alignment #28

Closed megazyz closed 1 year ago

megazyz commented 1 year ago

Setting AlignmentDialogPopupPositioner.HorizontalAlignment or VerticalAlignment to Stretch does not have an effect, the dialog gets aligned to the top left corner.

Sample code:

<dialogHostAvalonia:DialogHost CloseOnClickAway="True" IsOpen="True">
    <dialogHostAvalonia:DialogHost.PopupPositioner>
        <positioners:AlignmentDialogPopupPositioner VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
    </dialogHostAvalonia:DialogHost.PopupPositioner>
    <dialogHostAvalonia:DialogHost.DialogContent>
        <Border Background="Yellow" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <TextBlock>Dialog content</TextBlock>
        </Border>
    </dialogHostAvalonia:DialogHost.DialogContent>
    Welcome to Avalonia!
</dialogHostAvalonia:DialogHost>

I have a commit that fixes this, but I am not sure if it is a valid solution or just a hack: https://github.com/AvaloniaUtils/DialogHost.Avalonia/commit/4f0a7fd5cfc87f0df0308d50e27d47c5b43f2ecd

SKProCH commented 1 year ago

Hello, @megazyz Thanks!

Can you please test it in refactorDialogHostStyling branch? I've redone many things there, i thing what it should works there. I also take a look at your fix in a next day or two

megazyz commented 1 year ago

It works as expected in refactorDialogHostStyling branch

SKProCH commented 1 year ago

I tried to check your commit, but it causes other display bugs. I'll try to see how this can be fixed, and I'll post the work from refactorDialogHostStyling branch as a preview release.

Also, i will be happy if you submit a PR with the fix of this positioner bug :)