Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

japarson
Copy link
Contributor

@japarson japarson commented Sep 26, 2023

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 #15122

Depends on

@japarson japarson requested a review from a team as a code owner September 26, 2023 19:04
@Eilon Eilon added the area-image Image loading, sources, caching label Sep 26, 2023
@hartez hartez added this to the .NET 8 + Servicing milestone Sep 26, 2023
emaf
emaf previously approved these changes Oct 6, 2023
Copy link
Contributor

@hartez hartez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to resolve our design discussion about how to handle remapping within Core before we can merge this. Scheduled a meeting, we'll update this as soon as we figure it out.

@samhouts samhouts added the do-not-merge Don't merge this PR label Oct 9, 2023
@samhouts samhouts added the stale Indicates a stale issue/pr and will be closed soon label Nov 21, 2023
@PureWeen
Copy link
Member

/rebase

@jsuarezruiz jsuarezruiz removed their request for review January 24, 2024 11:57
@samhouts samhouts added platform/windows 🪟 and removed stale Indicates a stale issue/pr and will be closed soon labels Feb 1, 2024
@PureWeen
Copy link
Member

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

@PureWeen PureWeen removed this from the Under Consideration milestone Mar 27, 2024
@Foda
Copy link
Member

Foda commented Mar 28, 2024

/rebase

@Foda
Copy link
Member

Foda commented Mar 28, 2024

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

@japarson
Copy link
Contributor Author

/rebase

@japarson
Copy link
Contributor Author

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

@Foda Test is added and conflicts are resolved.

Copy link
Member

@Foda Foda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Eilon Eilon added area-controls-image Image control and removed area-image Image loading, sources, caching labels May 10, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the changes in the UI Test runner, we need to regenerate the snapshot (now navigates directly to the issue page, and the NavigationBar will no be rendered).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running a new build.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Image is not centered in AspectFill mode
8 participants