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

Button does not spread in RelativePanel #9617

Closed
shinta0806 opened this issue May 7, 2024 · 5 comments
Closed

Button does not spread in RelativePanel #9617

shinta0806 opened this issue May 7, 2024 · 5 comments
Labels
area-Layouts bug Something isn't working team-Controls Issue for the Controls team

Comments

@shinta0806
Copy link

shinta0806 commented May 7, 2024

Describe the bug

Place the Button in the RelativePanel,

  • RelativePanel.AlignLeftWithPanel="True"
  • RelativePanel.AlignRightWithPanel="True"

does not cause the Button to extend to the left or right.

The same problem exists in the vertical direction.

  • RelativePanel.AlignTopWithPanel="True"
  • RelativePanel.AlignBottomWithPanel="True"

Steps to reproduce the bug

  1. Place the RelativePanel.
  2. Place the Button inside the RelativePanel.
  3. Set AlignLeftWithPanel / AlignRightWithPanel property.

Sample program in GitHub:
https://github.com/shinta0806/TestRelativePanel

Expected behavior

TextBox spreads in RelativePanel.
I would like the Button to behave the same as the TextBox.

Screenshots

2

1

[NG] Button
[NG] ComboBox

[OK] TextBox

NuGet package version

WinUI 3 - Windows App SDK 1.5.3: 1.5.240428000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@shinta0806 shinta0806 added the bug Something isn't working label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 7, 2024
@shinta0806
Copy link
Author

Hi, AI.
This bug occurs even if the window is not resized.

@chrisglein chrisglein added area-Layouts team-Controls Issue for the Controls team labels May 8, 2024
@codendone codendone removed the needs-triage Issue needs to be triaged by the area owners label May 10, 2024
@codendone
Copy link
Contributor

I suspect this is due to the behavior certain controls choose. Button will stretch if HorizontalAlignment and VerticalAlignment are set, like this:

<RelativePanel Background="Aquamarine">
    <Button Content="Button" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True"
        RelativePanel.AlignTopWithPanel="True" RelativePanel.AlignBottomWithPanel="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</RelativePanel>

But RelativeLayout owners will need to confirm if that is required or if there is a bug here.

@MikeHillberg
Copy link
Contributor

Button's default style sets the HorizontalAlignment to left. So it's the same in a StackPanel or Grid that it won't fill all available space unless you explicitly set it to Stretch.

@shinta0806
Copy link
Author

Thank you very much!
I close this ticket.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 11, 2024
@codendone codendone removed the needs-triage Issue needs to be triaged by the area owners label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Layouts bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants