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

Question: How do I remove the default rounded corner of Buttons and TextBoxes? #1626

Closed
mdmozibur opened this issue Nov 17, 2019 · 3 comments
Labels

Comments

@mdmozibur
Copy link
Contributor

After upgrading to the latest WinUI library, the Buttons and TextBoxes have rounded corners. But I want the previous sharp corners.
Manually setting CornerRadius to 0 fro all the controls is a pain. Is there a ThemeResource which I can override to set the default corner radius to 0 for Buttons and TextBoxes?

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Nov 17, 2019
@Felix-Dev
Copy link
Contributor

Felix-Dev commented Nov 17, 2019

@Muziburrahman There is a global control corner radius theme resource which you can use: ControlCornerRadius

Example:

<Page.Resources>
     <CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Page.Resources>

This sets the corner radius for every control on that page to 0 (excluding overlay controls such as Popup and Flyout). If you only want to change the control corner radius for select controls, I'm afraid you currently have to use styles to achieve this.

If you also want to restore the previous border thickness, you have per-control resources to achieve this:

<Page.Resources>
     <Thickness x:Key="TextControlBorderThemeThickness">0</Thickness>
</Page.Resources>

You will note I used page-level scope here and not application-level scope. There is a known bug which prevents these resource overrides to be applied when defined with the latter scope level.

Additional resources to check out:

@mdmozibur
Copy link
Contributor Author

@Felix-Dev thanks a lot. :D

@msft-github-bot msft-github-bot removed the needs-triage Issue needs to be triaged by the area owners label Nov 17, 2019
@marcelwgn
Copy link
Collaborator

As @Felix-Dev mentioned there is an open issue regarding the setting of this value in application resources. However maybe this issue was partially resolved, since I was able to remove the corner radius by adding the following

<CornerRadius x:Key="ControlCornerRadius">0,0,0,0</CornerRadius>

to the application resources.

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

No branches or pull requests

4 participants