-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: added general lightweight styling
fix: screenshots fix: spacing and commas Co-authored-by: Xiaotian Gu <[email protected]> Co-authored-by: Agnès ZITTE <[email protected]> fix: resource keys list Co-authored-by: Xiaotian Gu <[email protected]> fix: xml code changes docs: lightweight styling fix: missing word Co-authored-by: Agnès ZITTE <[email protected]> fix: added further reading docs: added lightweight styling docs fix: images docs: added lightweight styling docs
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
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.
This file contains 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,58 @@ | ||
# Lightweight Styling | ||
|
||
[Lightweight styling](https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-styles#lightweight-styling) is a way to customize the appearance of XAML controls by **overriding** the system brushes that they use. Lightweight styling is applied in the Resources of the control itself: | ||
|
||
```xml | ||
<Button Content="Default Button Style" Style="{StaticResource MaterialFilledButtonStyle}" /> | ||
|
||
<Button Content="Overridden Button Style" Style="{StaticResource MaterialFilledButtonStyle}" BorderThickness="2"> | ||
<Button.Resources> | ||
<SolidColorBrush x:Key="FilledButtonForeground" Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBackground" Color="LightGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrush" Color="DarkGreen" /> | ||
</Button.Resources> | ||
</Button> | ||
``` | ||
|
||
![Material - Button lightweight styling](assets/material-lightweight-styling-anatomy.png) | ||
|
||
Most controls have multiple states, such as **PointerOver** (mouse is hovered over), **Pressed** (control is pressed on), and **Disabled** (control is not interactable). These states are appended onto the endings of the resource keys: ButtonForeground*PointerOver*, ButtonForeground*Pressed*, and ButtonForeground*Disabled*. Some controls even have **Checked** and **Unchecked** states. | ||
|
||
```xml | ||
<Button Content="Overridden Button Style" Style="{StaticResource MaterialFilledButtonStyle}" BorderThickness="2"> | ||
<Button.Resources> | ||
<SolidColorBrush x:Key="FilledButtonForeground" Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBackground" Color="LightGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrush" Color="DarkGreen" /> | ||
|
||
<!-- Overriding the PointerOver brushes --> | ||
<SolidColorBrush x:Key="FilledButtonForegroundPointerOver" Color="DarkRed" /> | ||
<SolidColorBrush x:Key="FilledButtonBackgroundPointerOver" Color="LightPink" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrushPointerOver" Color="DarkRed" /> | ||
</Button.Resources> | ||
</Button> | ||
``` | ||
|
||
![Material - Button lightweight styling](assets/material-button-pointerover-lightweight-styling.png) | ||
|
||
## Resource Keys | ||
For more information about the lightweight styling resource keys used in each control, check out the following links: | ||
- [Button]() | ||
- [CheckBox]() | ||
- [ComboBox]() | ||
- [DatePicker]() | ||
- [FloatingActionButton]() | ||
- [HyperlinkButton]() | ||
- [NavigationView]() | ||
- [PasswordBox]() | ||
- [PipsPager]() | ||
- [ProgressBar]() | ||
- [ProgressRing]() | ||
- [RadioButton]() | ||
- [Slider]() | ||
- [TextBlock]() | ||
- [TextBox]() | ||
- [ToggleButton]() | ||
|
||
### Further Reading | ||
https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-styles#lightweight-styling |