Added 'Custom PseudoClasses' section to styles.md

This commit is contained in:
Markus Wenzl 2022-01-06 09:38:40 +01:00
Родитель 4529b9cc8b
Коммит a17bb06a05
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -108,6 +108,15 @@ Another example that involves changing properties inside of control [template](s
Other pseudoclasses include `:focus`, `:disabled`, `:pressed` for buttons, `:checked` for checkboxes etc.
### Custom PseudoClasses <a id="custom-pseudoclasses"></a>
You can create own pseudoclasses for your `CustomControl` or `TemplatedControl`.
The function below adds or remove a pseudoclass depending on a boolean value on a `StyledElement`.
````csharp
PseudoClasses.Set(":className", bool);
````
***Remember:** PseudoClasses always starts with a `:`!*
### Selectors <a id="selectors"></a>
_Selectors_ select a control using a custom selector syntax which is very similar to the syntax used for CSS selectors. An example of some selectors: