-
Notifications
You must be signed in to change notification settings - Fork 38
Corner Radius (aka Rounded Corner) How-To document #34
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
Open
chigy
wants to merge
65
commits into
master
Choose a base branch
from
user/chigy/roundedcorner
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
2614231
Create roundedcorner.md
chigy 5d0d5a6
Update roundedcorner.md
chigy c007456
Update roundedcorner.md
chigy 896f6fd
Update roundedcorner.md
chigy 8fb83b1
Update roundedcorner.md
chigy 832588f
Create Readme.txt
chigy e5a509a
Add files via upload
chigy 5abed9a
Delete Grid View.png
chigy 00c2823
Add files via upload
chigy 583d881
Add files via upload
chigy e9b18cd
Delete Grid View.png
chigy 2f816a8
Create Grid View.png
chigy cac537a
Add files via upload
chigy 8fa8cd6
Delete Grid View.png
chigy a109a9f
Add files via upload
chigy 3224f9e
Add files via upload
chigy 281cda9
Delete Grid View 1.png
chigy 112f92d
Update roundedcorner.md
chigy 0cad650
Add files via upload
chigy 332a48b
Update roundedcorner.md
chigy 0bdadae
Update roundedcorner.md
chigy c34b645
Add files via upload
chigy cf24939
Update roundedcorner.md
chigy 4d733c7
Add files via upload
chigy 33f0009
Update roundedcorner.md
chigy 85bf5af
Add files via upload
chigy 8875093
Add files via upload
chigy dfcda76
Update roundedcorner.md
chigy 8f907f6
Delete SplitButton.png
chigy c747140
Add files via upload
chigy d754c57
Update roundedcorner.md
chigy f47483e
Update roundedcorner.md
chigy d013a02
Delete SplitButton.png
chigy a29c73d
Update roundedcorner.md
chigy 9948823
Add files via upload
chigy a37c4a4
Update roundedcorner.md
chigy 577259d
typos (#30)
mrlacey 379167f
Update roundedcorner.md
chigy 9f9f119
Delete Readme.txt
chigy a4fe7e9
Update roundedcorner.md
chigy b3c0fce
Add files via upload
chigy 92fd8ee
Update roundedcorner.md
chigy 3bda3d3
Add files via upload
chigy 25abcc2
Update roundedcorner.md
chigy bd36ac2
Update roundedcorner.md
chigy b83ba63
Update roundedcorner.md
chigy ba10f1a
Update roundedcorner.md
chigy 7672dc7
Update roundedcorner.md
chigy 7d24614
Update active/RoundedCorner/roundedcorner.md
chigy 7d6ef90
Update active/RoundedCorner/roundedcorner.md
chigy f0180b9
Update active/RoundedCorner/roundedcorner.md
chigy 52aef18
Update active/RoundedCorner/roundedcorner.md
chigy 8a47d41
Update active/RoundedCorner/roundedcorner.md
chigy 3b4cac9
Update active/RoundedCorner/roundedcorner.md
chigy 969062f
Update active/RoundedCorner/roundedcorner.md
chigy edd09ad
Update active/RoundedCorner/roundedcorner.md
chigy 6429dfd
Update roundedcorner.md
chigy 1046880
Update active/RoundedCorner/roundedcorner.md
chigy 0819591
Update active/RoundedCorner/roundedcorner.md
chigy 76ba1f5
Update active/RoundedCorner/roundedcorner.md
chigy 22aaac6
Update active/RoundedCorner/roundedcorner.md
chigy 615c859
Update active/RoundedCorner/roundedcorner.md
chigy 79ca32b
Apply suggestions from code review
chigy 19b345c
Added to customization section
kikisaints 2cfd60c
Update roundedcorner.md
chigy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| # Corner Radius | ||
|  | ||
| <Add thinking behind why we are rounding corners related to Fluent design.> | ||
|
|
||
| ## Background | ||
| This "spec" will be what is being proposed to be copied over to docs.microsoft.com as a documentation under https://docs.microsoft.com/en-us/windows/uwp/design/style/ "Corner Radius" page to be created. | ||
|
|
||
| I am trying out writing a little more "background explanation (WHY)" that our customers have expressed we provide with our documentation in some of our focus groups. I would like feedback as this does not follow normal documentation pattern. | ||
|
|
||
| ## Principles | ||
| Rounded corners lessen cognitive load for users to visually process UI and evoke warmth and trust. | ||
|
|
||
| ## Default control designs | ||
| There are mainly 3 types of UI parts where the radii of the corners are being rounded and here are the descriptions of how this is applied to default controls. | ||
|
|
||
| *Corners of rectangle UI elements* | ||
| - These UI elements include basic controls like buttons that users see on screen at all times. | ||
| - The default radius value we use are 2px for these UI. | ||
|  | ||
|
|
||
| **Controls being rounded** | ||
| - Button | ||
| - CheckBox | ||
| - ComboBox | ||
| - DropDownButton | ||
| - Slider | ||
| - SplitButton | ||
| - ToggleButton | ||
| - ToggleSplitButton | ||
| - Flipview | ||
| - GridView | ||
| - ListView | ||
| - TreeView | ||
| - ContentDialog | ||
| - AutoSuggestBox | ||
| - PasswordBox | ||
| - RichEditBox | ||
| - TextBox | ||
| - DatePicker | ||
| - CalendarDatePicker | ||
| - Tab control | ||
|
|
||
| *Corners of flyout UI elements* | ||
| - These are transient UI elements that appear on screen temporarily, for example MenuFlyout or Flyout. | ||
| - The default radius value we use here are 4px. | ||
|  | ||
|
|
||
| **Controls being rounded** | ||
| - CalendarDatePicker | ||
| - DatePicker | ||
| - TimePicker | ||
| - Flyout | ||
| - TeachingTip | ||
| - ToolTip | ||
| - DropDownButton | ||
| - SplitButton | ||
| - Slider (tooltip flyout only) | ||
| - AutoSuggestBox | ||
| - CommandBarFlyout | ||
| - MenuFlyout | ||
| - ComboBox | ||
| - ColorPicker | ||
| - MediaPlayerElement | ||
| - ContentDialog | ||
| - MenuBar | ||
| - ToggleSplitButton | ||
|
|
||
| *Rounding of bars* | ||
| - These UI elements are shaped like bars or lines, for example ProgressBar. | ||
| - The default radius values we use here are 2px. One exception is the slider in ColorPicker which will be 6px because the bar is wider. | ||
|  | ||
|
|
||
| **Controls being rounded** | ||
| - NavigationView's selection indicator | ||
| - Pivot's selection indicator | ||
| - ScrollIndicator | ||
| - ProgressBar | ||
| - Slider | ||
| - ColorPicker's slider | ||
| - MediaPlayerElement (tooltip flyout only) | ||
|
|
||
| Note: WebView uses the scroll indicator coming from HTML directly. So this will not be rounded until scroll indicator from hosted HTML gets the rounded treatment. | ||
|
|
||
| ### When not to round | ||
| - When multiple UI elements touch each other that is housed inside a container (e.g. ScrollBar's bar and buttons touch each other inside the ScrollBar container), there should be no space when they contact. | ||
|  | ||
| - When a control is housed inside another container (e.g. ScrollBar's bar and buttons that are part of the ScrollBar container which is also part of a ScrollViewer). | ||
|
|
||
|  | ||
| - When flyout UI element that is connected to a UI that invokes the flyout on one side. | ||
|  | ||
|
|
||
| ## Note on keyboard focus rect and shadow | ||
chigy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Currently our default design does not require any special work to round the corners of keyboard focus rectangle and shadow. Using higher corner radius value will not break them functionally, however it is good to be aware of this to avoid unwanted visual glitches that you could introduce with a larger value. | ||
chigy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Here is an example of larger corner radius make the shadow look undesirable. | ||
|  | ||
|
|
||
| # Rounded Corner and Performance | ||
| People may not always be aware of the fact drawing rounded corner naturally use more drawing power compared to square corners. When selecting the value of corner radius, we not only considered the design principles but also were very careful to ensure developers who use our default controls are able to successfully deliver performant applications. | ||
|
|
||
| To simplify this section, think of performance issues mentioned here to be mainly about page load time as well as app launch time. | ||
|
|
||
| Key information to note: | ||
| - Rounded corners on a larger surface UI are less performant. Avoid drawing rounded corner on a full screen app UI. This is less of an issue if the UI is displayed briefly (e.g. ContentDialog). | ||
|
|
||
| # Customization options | ||
| The default corner radii values that we provide are not set in stone and there are a few ways the app-developer can easily modify the rounded amount. This can be done through two global resources, or through the 'CornerRadius' property directly on the control, depending on the level of customization granularity desired. | ||
|
|
||
| ## Page or app-wide CornerRadius changes | ||
| The two main resources that control the corner radiis of all the controls are: | ||
|
|
||
| - `OverlayCornerRadius` | ||
| - `ControlCornerRadius` | ||
|
|
||
| Changing these two resources' values at any scope will effect all controls within that scope accordingly. | ||
|
|
||
| This means if you want to change the roundness of all controls where roundness could be applied, you can define both resources at the app level, with the new CornerRadius values like so: | ||
|
|
||
| ``` xml | ||
| <Application.Resources> | ||
| <Thickness x:Key="OverlayCornerRadius">4</Thickness> | ||
| <Thickness x:Key="ControlCornerRadius">8</Thickness> | ||
| </Application.Resources> | ||
| ``` | ||
|
|
||
| Alternately, if you want to change all controls' roundness within a particular scope, like at a page or container level, you can follow a similar pattern: | ||
|
|
||
| ``` xml | ||
| <Grid x:Name="myGrid"> | ||
| <Grid.Resources> | ||
| <Thickness x:Key="ControlCornerRadius">8</Thickness> | ||
| </Grid.Resources> | ||
| </Grid> | ||
| ``` | ||
|
|
||
| **Can I define OverlayCornerRadius at a page or container level?** | ||
|
|
||
| The `OverlayCornerRadius` must be defined at the app level in order to take effect. | ||
|
|
||
| This is because our popups and flyouts are dynamic and created at the root element in the Visual Tree. Meaning any resources that they use should also be defined there. Otherwise they're out of scope. | ||
|
|
||
| ## Per-control CornerRadius changes | ||
| The `CornerRadius` property on controls can also be modified directly, if changing the roundness of only a select number of controls is desired. | ||
|
|
||
| |default | property modified | | ||
| |:-- |:-- | | ||
| || | | ||
| |`<CheckBox Content="Checkbox"/>` | `<CheckBox Content="Checkbox" CornerRadius="5"/> ` | | ||
|
|
||
| **It's important to note** that not all controls' corners will respond to their `CornerRadius` property being modified. | ||
|
|
||
| To ensure that the control whose corners you wish to round will indeed respond to their `CornerRadius` property the way you expect, first check that the `ControlCornerRadius` or `OverlayCornerRadius` global resources affect the control in question. If they do not, check that the control you wish to round has corners at all. Many of our controls do not render actual edges and therefore cannot make proper use of the `CornerRadius` property. | ||
|
|
||
| # Appendix | ||
| Here are relevant visual comp files: | ||
| - Raw files: https://github.com/microsoft/microsoft-ui-xaml-specs/tree/user/chigy/roundedcorner/active/RoundedCorner/ImageFiles | ||
| - In an easier to consume format thanks to community: https://github.com/mrlacey/microsoft-ui-xaml-specs/blob/RoundedCornerVisualizations/active/RoundedCorner/ImageFiles/index.md | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.