maui icon indicating copy to clipboard operation
maui copied to clipboard

Wrap Image with a container on Windows so that it is centered with AspectFill

Open japarson opened this issue 1 year ago • 4 comments

Description of Change

On Windows, we use Microsoft.UI.Xaml.Controls.Image which has a stretch property. When this property is set in WinUI, the image will not be centered. According to the WinUI team, this is intended behavior:

image

As you can see in the screenshot above, one workaround we can utilize is to wrap the image in a Grid. Luckily, we can utilize the existing WrapperView on Windows by adding a ContainerView to the Windows ImageHandler.

Before

image

After

image

Issues Fixed

Fixes #10645

Copied from https://github.com/dotnet/maui/pull/15122

Depends on

  • [ ] https://github.com/dotnet/maui/pull/17918

japarson avatar Sep 26 '23 19:09 japarson

/rebase

PureWeen avatar Dec 21 '23 16:12 PureWeen

For now let's just merge this without the updated extensions. And we can just fix those in post

PureWeen avatar Mar 27 '24 22:03 PureWeen

/rebase

Foda avatar Mar 28 '24 17:03 Foda

@japarson Could you please resolve conflicts and add a UI test? Thanks!

Foda avatar Mar 28 '24 21:03 Foda

/rebase

japarson avatar Apr 19 '24 18:04 japarson

@japarson Could you please resolve conflicts and add a UI test? Thanks!

@Foda Test is added and conflicts are resolved.

japarson avatar Apr 22 '24 17:04 japarson

/azp run

jsuarezruiz avatar May 13 '24 13:05 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar May 13 '24 13:05 azure-pipelines[bot]