Skip to content

Commit b52de64

Browse files
authored
Updated styles-and-resources/troubleshooting.md (#710)
* Updated styles-and-resources/troubleshooting.md * Updated styles-and-resources/troubleshooting.md * add titles.
1 parent 75a9a5f commit b52de64

File tree

3 files changed

+74
-53
lines changed

3 files changed

+74
-53
lines changed

docs/guides/styles-and-resources/troubleshooting.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ Check whether you have used a child selector where there are no children to matc
2424

2525
Styles are applied in order of declaration. If there are multiple style files included that target the same control property, the last style included will override the previous ones. For example:
2626

27-
```xml
27+
```xml title="Style1.axaml"
2828
<Style Selector="TextBlock.header">
29-
<Style Property="Foreground" Value="Green" />
29+
<Setter Property="Foreground" Value="Green" />
3030
</Style>
3131
```
3232

33-
```xml
33+
```xml title="Style2.axaml"
3434
<Style Selector="TextBlock.header">
35-
<Style Property="Foreground" Value="Blue" />
36-
<Style Property="FontSize" Value="16" />
35+
<Setter Property="Foreground" Value="Blue" />
36+
<Setter Property="FontSize" Value="16" />
3737
</Style>
3838
```
3939

@@ -58,7 +58,14 @@ A local value defined directly on a control often has higher priority than any s
5858

5959
You can see the full list of value priorities in the `BindingPriority` enum, where lower enum values have the higher priority.
6060

61-
<table><thead><tr><th width="218">BindingPriority </th><th width="147.33333333333331">Value</th><th>Comment</th></tr></thead><tbody><tr><td><code>Animation</code></td><td>-1</td><td>The highest priority - even overrides a local value</td></tr><tr><td><code>LocalValue</code></td><td>0</td><td>A local value is set on the property of the control.</td></tr><tr><td><code>StyleTrigger</code></td><td>1</td><td>This is triggered when a pseudo class becomes active.</td></tr><tr><td><code>TemplatedParent</code></td><td>2</td><td></td></tr><tr><td><code>Style</code></td><td>3</td><td></td></tr><tr><td><code>Unset</code></td><td>2147483647</td><td></td></tr></tbody></table>
61+
| BindingPriority | Value | Comment |
62+
|-----------------|------------|------------------------------------------------------|
63+
| `Animation` | -1 | The highest priority - even overrides a local value |
64+
| `LocalValue` | 0 | A local value is set on the property of the control. |
65+
| `StyleTrigger` | 1 | This is triggered when a style becomes active. |
66+
| `Template` | 2 | |
67+
| `Style` | 3 | |
68+
| `Unset` | 2147483647 | |
6269

6370
:::warning
6471
The exception is that `Animation` values have the highest priority and can even override local values.
@@ -104,7 +111,7 @@ The following code example of styles that can be expected to work on top of defa
104111

105112
You might expect the `Button` to be red by default and blue when pointer is over it. In fact, only setter of first style will be applied, and second one will be ignored.
106113

107-
The reason is hidden in the Button's template. You can find the default templates in the Avalonia source code (old [Default](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Default/Button.xaml) theme and new [Fluent](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml) theme), but for convenience here we have simplified one from the Fluent theme:
114+
The reason is hidden in the Button's template. You can find the default templates in the Avalonia source code ([Simple](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Simple/Controls/Button.xaml) theme and [Fluent](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml) theme), but for convenience here we have simplified one from the Fluent theme:
108115

109116
```xml
110117
<Style Selector="Button">
@@ -132,7 +139,7 @@ The actual background is rendered by a `ContentPresenter`, which in the default
132139
```
133140

134141
:::info
135-
You can see this behavior for all controls in the default themes (both old Default and the new Fluent), not just Button. And not just for Background, but also other state-dependent properties.
142+
You can see this behavior for all controls in the default themes (both Simple and Fluent), not just Button. And not just for Background, but also other state-dependent properties.
136143
:::
137144

138145
:::info

i18n/ru/docusaurus-plugin-content-docs/current/guides/styles-and-resources/troubleshooting.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ Check whether you have used a child selector where there are no children to matc
2424

2525
Styles are applied in order of declaration. If there are multiple style files included that target the same control property, the last style included will override the previous ones. For example:
2626

27-
```xml
27+
```xml title="Style1.axaml"
2828
<Style Selector="TextBlock.header">
29-
<Style Property="Foreground" Value="Green" />
29+
<Setter Property="Foreground" Value="Green" />
3030
</Style>
3131
```
3232

33-
```xml
33+
```xml title="Style2.axaml"
3434
<Style Selector="TextBlock.header">
35-
<Style Property="Foreground" Value="Blue" />
36-
<Style Property="FontSize" Value="16" />
35+
<Setter Property="Foreground" Value="Blue" />
36+
<Setter Property="FontSize" Value="16" />
3737
</Style>
3838
```
3939

@@ -58,7 +58,14 @@ A local value defined directly on a control often has higher priority than any s
5858

5959
You can see the full list of value priorities in the `BindingPriority` enum, where lower enum values have the higher priority.
6060

61-
<table><thead><tr><th width="218">BindingPriority </th><th width="147.33333333333331">Value</th><th>Comment</th></tr></thead><tbody><tr><td><code>Animation</code></td><td>-1</td><td>The highest priority - even overrides a local value</td></tr><tr><td><code>LocalValue</code></td><td>0</td><td>A local value is set on the property of the control.</td></tr><tr><td><code>StyleTrigger</code></td><td>1</td><td>This is triggered when a pseudo class becomes active.</td></tr><tr><td><code>TemplatedParent</code></td><td>2</td><td></td></tr><tr><td><code>Style</code></td><td>3</td><td></td></tr><tr><td><code>Unset</code></td><td>2147483647</td><td></td></tr></tbody></table>
61+
| BindingPriority | Value | Comment |
62+
|-----------------|------------|------------------------------------------------------|
63+
| `Animation` | -1 | The highest priority - even overrides a local value |
64+
| `LocalValue` | 0 | A local value is set on the property of the control. |
65+
| `StyleTrigger` | 1 | This is triggered when a style becomes active. |
66+
| `Template` | 2 | |
67+
| `Style` | 3 | |
68+
| `Unset` | 2147483647 | |
6269

6370
:::warning
6471
The exception is that `Animation` values have the highest priority and can even override local values.
@@ -104,7 +111,7 @@ The following code example of styles that can be expected to work on top of defa
104111

105112
You might expect the `Button` to be red by default and blue when pointer is over it. In fact, only setter of first style will be applied, and second one will be ignored.
106113

107-
The reason is hidden in the Button's template. You can find the default templates in the Avalonia source code (old [Default](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Default/Button.xaml) theme and new [Fluent](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml) theme), but for convenience here we have simplified one from the Fluent theme:
114+
The reason is hidden in the Button's template. You can find the default templates in the Avalonia source code ([Simple](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Simple/Controls/Button.xaml) theme and [Fluent](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml) theme), but for convenience here we have simplified one from the Fluent theme:
108115

109116
```xml
110117
<Style Selector="Button">
@@ -132,7 +139,7 @@ The actual background is rendered by a `ContentPresenter`, which in the default
132139
```
133140

134141
:::info
135-
You can see this behavior for all controls in the default themes (both old Default and the new Fluent), not just Button. And not just for Background, but also other state-dependent properties.
142+
You can see this behavior for all controls in the default themes (both Simple and Fluent), not just Button. And not just for Background, but also other state-dependent properties.
136143
:::
137144

138145
:::info

0 commit comments

Comments
 (0)