# StyledElement

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/struct-styledelement/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct StyledElement
```

Extends an [`Animatable`](/docs/0.5.0/api/ferroui-base/animation/struct-animatable/) with the following features:

- An inherited `DataContext`.
- Implements the logical tree.
- A collection of class strings for custom styling.
- Implements styling: tracks the frames applied by styles and themes.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L32)

## Members

- [`get_logical_ancestors`](#function-get_logical_ancestors)
- [`get_self_and_logical_ancestors`](#function-get_self_and_logical_ancestors)
- [`find_logical_ancestor_of_type`](#function-find_logical_ancestor_of_type)
- [`get_logical_children`](#function-get_logical_children)
- [`get_logical_descendants`](#function-get_logical_descendants)
- [`get_self_and_logical_descendants`](#function-get_self_and_logical_descendants)
- [`find_logical_descendant_of_type`](#function-find_logical_descendant_of_type)
- [`get_logical_parent`](#function-get_logical_parent)
- [`get_logical_parent_of_type`](#function-get_logical_parent_of_type)
- [`get_logical_siblings`](#function-get_logical_siblings)
- [`is_logical_ancestor_of`](#function-is_logical_ancestor_of)
- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`begin_init`](#function-begin_init)
- [`try_end_init`](#function-try_end_init)
- [`logical_children_collection_changed`](#function-logical_children_collection_changed)
- [`on_attached_to_logical_tree`](#function-on_attached_to_logical_tree)
- [`on_detached_from_logical_tree`](#function-on_detached_from_logical_tree)
- [`on_data_context_changed`](#function-on_data_context_changed)
- [`on_data_context_begin_update`](#function-on_data_context_begin_update)
- [`on_data_context_end_update`](#function-on_data_context_end_update)
- [`on_initialized`](#function-on_initialized)
- [`style_key_override`](#function-style_key_override)
- [`on_control_theme_changed`](#function-on_control_theme_changed)
- [`on_templated_parent_control_theme_changed`](#function-on_templated_parent_control_theme_changed)
- [`invalidate_styles`](#function-invalidate_styles)
- [`is_logical_root`](#function-is_logical_root)
- [`styling_parent`](#function-styling_parent)
- [`notify_child_resources_changed`](#function-notify_child_resources_changed)
- [`child_index_provider`](#function-child_index_provider)
- [`is_theme_variant_root`](#function-is_theme_variant_root)
- [`data_context_property`](#function-data_context_property)
- [`name_property`](#function-name_property)
- [`parent_property`](#function-parent_property)
- [`templated_parent_property`](#function-templated_parent_property)
- [`theme_property`](#function-theme_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`attached_to_logical_tree`](#function-attached_to_logical_tree)
- [`detached_from_logical_tree`](#function-detached_from_logical_tree)
- [`data_context_changed`](#function-data_context_changed)
- [`initialized`](#function-initialized)
- [`resources_changed`](#function-resources_changed)
- [`actual_theme_variant_changed`](#function-actual_theme_variant_changed)
- [`name`](#function-name)
- [`has_name`](#function-has_name)
- [`set_name`](#function-set_name)
- [`classes`](#function-classes)
- [`pseudo_classes`](#function-pseudo_classes)
- [`set_pseudo_class`](#function-set_pseudo_class)
- [`data_context`](#function-data_context)
- [`set_data_context`](#function-set_data_context)
- [`is_initialized`](#function-is_initialized)
- [`styles`](#function-styles)
- [`is_styles_initialized`](#function-is_styles_initialized)
- [`style_key`](#function-style_key)
- [`resources`](#function-resources)
- [`resources_if_created`](#function-resources_if_created)
- [`set_resources`](#function-set_resources)
- [`theme`](#function-theme)
- [`set_theme`](#function-set_theme)
- [`actual_theme_variant`](#function-actual_theme_variant)
- [`has_resources`](#function-has_resources)
- [`try_get_resource`](#function-try_get_resource)
- [`try_find_resource`](#function-try_find_resource)
- [`find_resource`](#function-find_resource)
- [`templated_parent`](#function-templated_parent)
- [`set_templated_parent`](#function-set_templated_parent)
- [`logical_children`](#function-logical_children)
- [`is_attached_to_logical_tree`](#function-is_attached_to_logical_tree)
- [`parent`](#function-parent)
- [`apply_styling`](#function-apply_styling)
- [`try_apply_styling`](#function-try_apply_styling)
- [`end_init`](#function-end_init)
- [`initialize_if_needed`](#function-initialize_if_needed)
- [`set_parent`](#function-set_parent)
- [`notify_attached_to_logical_tree`](#function-notify_attached_to_logical_tree)
- [`notify_detached_from_logical_tree`](#function-notify_detached_from_logical_tree)
- [`get_effective_theme`](#function-get_effective_theme)
- [`styles_added`](#function-styles_added)
- [`styles_removed`](#function-styles_removed)
- [`notify_resources_changed`](#function-notify_resources_changed)
- [`set_data_context_with_priority`](#function-set_data_context_with_priority)
- [`bind_class`](#function-bind_class)
- [`get_class_property`](#function-get_class_property)

<a id="function-get_logical_ancestors"></a>

### get_logical_ancestors

```rust
fn get_logical_ancestors(self: &Self) -> LogicalAncestors
```

Enumerates the ancestors of the element in the logical tree, from its
parent to the root.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L67)

<a id="function-get_self_and_logical_ancestors"></a>

### get_self_and_logical_ancestors

```rust
fn get_self_and_logical_ancestors(self: &Self) -> LogicalAncestors
```

Enumerates the element and its ancestors in the logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L72)

<a id="function-find_logical_ancestor_of_type"></a>

### find_logical_ancestor_of_type

```rust
fn find_logical_ancestor_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
```

Finds the first logical ancestor of class `T`, optionally starting
with the element itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L78)

<a id="function-get_logical_children"></a>

### get_logical_children

```rust
fn get_logical_children(self: &Self) -> Rc<Vec<Ref<StyledElement>>>
```

The logical children of the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L93)

<a id="function-get_logical_descendants"></a>

### get_logical_descendants

```rust
fn get_logical_descendants(self: &Self) -> LogicalDescendants
```

Enumerates the descendants of the element in the logical tree, in
depth-first pre-order.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L99)

<a id="function-get_self_and_logical_descendants"></a>

### get_self_and_logical_descendants

```rust
fn get_self_and_logical_descendants(self: &Self) -> LogicalDescendants
```

Enumerates the element and its descendants in the logical tree, in
depth-first pre-order.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L107)

<a id="function-find_logical_descendant_of_type"></a>

### find_logical_descendant_of_type

```rust
fn find_logical_descendant_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
```

Finds the first logical descendant of class `T` (depth first),
optionally starting with the element itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L115)

<a id="function-get_logical_parent"></a>

### get_logical_parent

```rust
fn get_logical_parent(self: &Self) -> Option<Ref<StyledElement>>
```

The logical parent of the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L126)

<a id="function-get_logical_parent_of_type"></a>

### get_logical_parent_of_type

```rust
fn get_logical_parent_of_type<T: ObjectType>(self: &Self) -> Option<Ref<T>>
```

The logical parent of the element, if it is of class `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L131)

<a id="function-get_logical_siblings"></a>

### get_logical_siblings

```rust
fn get_logical_siblings(self: &Self) -> Rc<Vec<Ref<StyledElement>>>
```

The children of the logical parent of the element, including the
element itself; empty when the element has no logical parent.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L138)

<a id="function-is_logical_ancestor_of"></a>

### is_logical_ancestor_of

```rust
fn is_logical_ancestor_of(self: &Self, target: Option<&StyledElement>) -> bool
```

Whether the element is a logical ancestor of `target`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/logical_extensions.rs#L147)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<StyledElement>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-begin_init"></a>

### begin_init

```rust
fn begin_init(self: &Self)
```

Signals the beginning of a batch of initialization: styling is
deferred until the matching `end_init`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-try_end_init"></a>

### try_end_init

```rust
fn try_end_init(self: &Self) -> Result<(), InitializationError>
```

Signals the end of a batch of initialization: the element is
styled (if it is attached to a rooted logical tree) and
initialized. A style or control theme that cannot be applied (two
setters for the same property) is an error, the counterpart of
the invalid operation `EndInit` raises in the managed original;
what follows the failure is skipped. This is the overridable
member; `end_init` is the form that
panics on the error.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-logical_children_collection_changed"></a>

### logical_children_collection_changed

```rust
fn logical_children_collection_changed(self: &Self, e: &NotifyCollectionChangedEventArgs<'_, Ref<StyledElement>>)
```

Called when the logical children collection changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_attached_to_logical_tree"></a>

### on_attached_to_logical_tree

```rust
fn on_attached_to_logical_tree(self: &Self, e: &LogicalTreeAttachmentEventArgs)
```

Called when the styled element is added to a rooted logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_detached_from_logical_tree"></a>

### on_detached_from_logical_tree

```rust
fn on_detached_from_logical_tree(self: &Self, e: &LogicalTreeAttachmentEventArgs)
```

Called when the styled element is removed from a rooted logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_data_context_changed"></a>

### on_data_context_changed

```rust
fn on_data_context_changed(self: &Self)
```

Called when the data context changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_data_context_begin_update"></a>

### on_data_context_begin_update

```rust
fn on_data_context_begin_update(self: &Self)
```

Called when the data context begins updating.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_data_context_end_update"></a>

### on_data_context_end_update

```rust
fn on_data_context_end_update(self: &Self)
```

Called when the data context finishes updating.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_initialized"></a>

### on_initialized

```rust
fn on_initialized(self: &Self)
```

Called when the control finishes initialization.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-style_key_override"></a>

### style_key_override

```rust
fn style_key_override(self: &Self) -> &'static TypeInfo
```

The type by which the element is styled. Defaults to the element's
own type; override to be styled as a base class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_control_theme_changed"></a>

### on_control_theme_changed

```rust
fn on_control_theme_changed(self: &Self)
```

Called when the control theme changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-on_templated_parent_control_theme_changed"></a>

### on_templated_parent_control_theme_changed

```rust
fn on_templated_parent_control_theme_changed(self: &Self)
```

Called when the templated parent's control theme changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-invalidate_styles"></a>

### invalidate_styles

```rust
fn invalidate_styles(self: &Self, recurse: bool)
```

Detaches all styles from the element (and optionally from its
inheritance children) so that they are re-applied.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-is_logical_root"></a>

### is_logical_root

```rust
fn is_logical_root(self: &Self) -> bool
```

Whether the element is the root of a logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-styling_parent"></a>

### styling_parent

```rust
fn styling_parent(self: &Self) -> Option<StyleHostRef>
```

The parent style host of the element: by default the inheritance
parent, when it is a styled element. The root of a tree overrides
this to return the host of the global styles.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-notify_child_resources_changed"></a>

### notify_child_resources_changed

```rust
fn notify_child_resources_changed(self: &Self, e: ResourcesChangedEventArgs)
```

Notifies the children of the element that the resources visible to
them have changed. The base method notifies the logical children.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-child_index_provider"></a>

### child_index_provider

```rust
fn child_index_provider(self: &Self) -> Option<Rc<dyn IChildIndexProvider>>
```

The child index provider implemented by the element, if any. Used
to match the children of the element by their position.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-is_theme_variant_root"></a>

### is_theme_variant_root

```rust
fn is_theme_variant_root(self: &Self) -> bool
```

Whether the element is a root of theme variant resolution: at a
root the default theme variant resolves to the variant of the
platform instead of being inherited.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L71)

<a id="function-data_context_property"></a>

### data_context_property

```rust
fn data_context_property() -> &'static StyledProperty<Option<BoxedValue>>
```

Defines the `DataContext` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L278)

<a id="function-name_property"></a>

### name_property

```rust
fn name_property() -> &'static DirectProperty<StyledElement, Option<String>>
```

Defines the `Name` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L278)

<a id="function-parent_property"></a>

### parent_property

```rust
fn parent_property() -> &'static DirectProperty<StyledElement, Option<Ref<StyledElement>>>
```

Defines the `Parent` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L278)

<a id="function-templated_parent_property"></a>

### templated_parent_property

```rust
fn templated_parent_property() -> &'static DirectProperty<StyledElement, Option<Ref<FerroObject>>>
```

Defines the `TemplatedParent` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L278)

<a id="function-theme_property"></a>

### theme_property

```rust
fn theme_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
```

Defines the `Theme` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L278)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L330)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L359)

<a id="function-attached_to_logical_tree"></a>

### attached_to_logical_tree

```rust
fn attached_to_logical_tree(self: &Self, handler: impl Fn(&LogicalTreeAttachmentEventArgs) -> () + 'static) -> Subscription
```

Raised when the styled element is attached to a rooted logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L366)

<a id="function-detached_from_logical_tree"></a>

### detached_from_logical_tree

```rust
fn detached_from_logical_tree(self: &Self, handler: impl Fn(&LogicalTreeAttachmentEventArgs) -> () + 'static) -> Subscription
```

Raised when the styled element is detached from a rooted logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L380)

<a id="function-data_context_changed"></a>

### data_context_changed

```rust
fn data_context_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
```

Occurs when the data context property changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L394)

<a id="function-initialized"></a>

### initialized

```rust
fn initialized(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
```

Occurs when the styled element has finished initialization.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L405)

<a id="function-resources_changed"></a>

### resources_changed

```rust
fn resources_changed(self: &Self, handler: impl Fn(&ResourcesChangedEventArgs) -> () + 'static) -> Subscription
```

Raised when the resources change on the element or an ancestor of the
element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L417)

<a id="function-actual_theme_variant_changed"></a>

### actual_theme_variant_changed

```rust
fn actual_theme_variant_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
```

Raised when the theme variant in effect for the element changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L435)

<a id="function-name"></a>

### name

```rust
fn name(self: &Self) -> Option<String>
```

The name of the styled element.

An element's name is used to uniquely identify it within its name
scope. Once the element has been styled its name may not be changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L455)

<a id="function-has_name"></a>

### has_name

```rust
fn has_name(self: &Self, name: &str) -> bool
```

Whether the name of the styled element is `name`, without a copy of the name (the name
selectors of styles test it for every element they are evaluated on).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L462)

<a id="function-set_name"></a>

### set_name

```rust
fn set_name(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L466)

<a id="function-classes"></a>

### classes

```rust
fn classes(self: &Self) -> Classes
```

The styled element's classes.

The collection is returned by handle: clones refer to the same
collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L475)

<a id="function-pseudo_classes"></a>

### pseudo_classes

```rust
fn pseudo_classes(self: &Self) -> &dyn IPseudoClasses
```

The pseudoclasses of the element, settable by the control itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L485)

<a id="function-set_pseudo_class"></a>

### set_pseudo_class

```rust
fn set_pseudo_class(self: &Self, name: &str, value: bool)
```

Adds or removes a pseudoclass. Removing one from an element whose classes were never made
makes nothing: an element without classes holds none to remove. An addition (FerroUI
deviation, desktop-performance.md section 9.21): every input element removed its focus,
pointer-over and disabled pseudoclasses when constructed, which made its collection of
classes (three allocations) whether it would ever have a class or not.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L494)

<a id="function-data_context"></a>

### data_context

```rust
fn data_context(self: &Self) -> Option<BoxedValue>
```

The control's data context.

The data context is an inherited property that specifies the default
object that will be used for data binding.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L504)

<a id="function-set_data_context"></a>

### set_data_context

```rust
fn set_data_context(self: &Self, value: Option<BoxedValue>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L508)

<a id="function-is_initialized"></a>

### is_initialized

```rust
fn is_initialized(self: &Self) -> bool
```

Whether the element has finished initialization.

For more information about when this happens, see the `initialized`
event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L516)

<a id="function-styles"></a>

### styles

```rust
fn styles(self: &Self) -> Ref<Styles>
```

The styles for the styled element.

Styles for the entire application are added to the application's
styles collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L524)

<a id="function-is_styles_initialized"></a>

### is_styles_initialized

```rust
fn is_styles_initialized(self: &Self) -> bool
```

Whether the styles collection of the element has been created.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L529)

<a id="function-style_key"></a>

### style_key

```rust
fn style_key(self: &Self) -> &'static TypeInfo
```

The type by which the element is styled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L534)

<a id="function-resources"></a>

### resources

```rust
fn resources(self: &Self) -> Ref<ResourceDictionary>
```

The styled element's resource dictionary.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L539)

<a id="function-resources_if_created"></a>

### resources_if_created

```rust
fn resources_if_created(self: &Self) -> Option<Ref<ResourceDictionary>>
```

The resource dictionary of the element if it has been created; unlike `resources`, this
does not create one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L550)

<a id="function-set_resources"></a>

### set_resources

```rust
fn set_resources(self: &Self, value: Ref<ResourceDictionary>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L554)

<a id="function-theme"></a>

### theme

```rust
fn theme(self: &Self) -> Option<Ref<ControlTheme>>
```

The theme to be applied to the element.

By default the theme is looked up as a resource keyed by the element's
style key; setting this property takes precedence over that lookup.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L568)

<a id="function-set_theme"></a>

### set_theme

```rust
fn set_theme(self: &Self, value: impl Into<Nullable<ControlTheme>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L572)

<a id="function-actual_theme_variant"></a>

### actual_theme_variant

```rust
fn actual_theme_variant(self: &Self) -> Option<ThemeVariant>
```

The UI theme variant that is currently used by the element, which
might be different than the requested theme variant. `None` until a
theme variant has been established for the element or an ancestor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L579)

<a id="function-has_resources"></a>

### has_resources

```rust
fn has_resources(self: &Self) -> bool
```

Whether the element or its styles have resources.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L584)

<a id="function-try_get_resource"></a>

### try_get_resource

```rust
fn try_get_resource(self: &Self, key: &ResourceKey, theme: Option<&ThemeVariant>) -> Option<ResourceValue>
```

Tries to find a resource within the element: in its resource
dictionary, then in its styles.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L591)

<a id="function-try_find_resource"></a>

### try_find_resource

```rust
fn try_find_resource(self: &Self, key: &ResourceKey, theme: Option<&ThemeVariant>) -> Option<ResourceValue>
```

Tries to find a resource by searching up the logical tree and then
the global styles.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L606)

<a id="function-find_resource"></a>

### find_resource

```rust
fn find_resource(self: &Self, key: &ResourceKey) -> ResourceValue
```

Finds a resource by searching up the logical tree and then the global
styles. Returns the unset value marker if it is not found.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L613)

<a id="function-templated_parent"></a>

### templated_parent

```rust
fn templated_parent(self: &Self) -> Option<Ref<FerroObject>>
```

The styled element whose lookless template this element is part of.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L619)

<a id="function-set_templated_parent"></a>

### set_templated_parent

```rust
fn set_templated_parent(self: &Self, value: impl Into<Nullable<FerroObject>>)
```

Sets the templated parent. Called by the template that creates the
element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L625)

<a id="function-logical_children"></a>

### logical_children

```rust
fn logical_children(self: &Self) -> &FerroList<Ref<StyledElement>>
```

The styled element's logical children.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L636)

<a id="function-is_attached_to_logical_tree"></a>

### is_attached_to_logical_tree

```rust
fn is_attached_to_logical_tree(self: &Self) -> bool
```

Whether the element is attached to a rooted logical tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L651)

<a id="function-parent"></a>

### parent

```rust
fn parent(self: &Self) -> Option<Ref<StyledElement>>
```

The styled element's logical parent.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L656)

<a id="function-apply_styling"></a>

### apply_styling

```rust
fn apply_styling(self: &Self) -> bool
```

Applies styling to the control if the control is initialized and
styling is not already applied.

The styling system will automatically apply styling when required, so
this method need only be called by tests or in rare special cases.

Returns true if styling is applied to the control, false if the
control is still initializing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L670)

<a id="function-try_apply_styling"></a>

### try_apply_styling

```rust
fn try_apply_styling(self: &Self) -> Result<bool, DuplicateSetterError>
```

As `apply_styling`, reporting a style or
control theme that cannot be applied (two setters for the same
property: the invalid operation of the managed original) instead of
panicking. After an error the styling pass is ended and the element
is not marked as styled, as when the managed original throws.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L682)

<a id="function-end_init"></a>

### end_init

```rust
fn end_init(self: &Self)
```

Signals the end of a batch of initialization
(`try_end_init`). A style or control theme that
cannot be applied panics with the message of the error.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L710)

<a id="function-initialize_if_needed"></a>

### initialize_if_needed

```rust
fn initialize_if_needed(self: &Self)
```

Marks the element as initialized and raises the initialization
notifications, if initialization is complete.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L718)

<a id="function-set_parent"></a>

### set_parent

```rust
fn set_parent(self: &Self, parent: impl Into<Nullable<StyledElement>>)
```

Sets the element's logical parent.

You should not usually need to call this method: it is called when an
element is added to or removed from a logical children collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L736)

<a id="function-notify_attached_to_logical_tree"></a>

### notify_attached_to_logical_tree

```rust
fn notify_attached_to_logical_tree(self: &Self, e: &LogicalTreeAttachmentEventArgs)
```

Notifies the element that it has been attached to a rooted logical
tree. Called by a parent for children that are part of its logical
tree without being in its logical children collection (the template
child of a templated control).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L788)

<a id="function-notify_detached_from_logical_tree"></a>

### notify_detached_from_logical_tree

```rust
fn notify_detached_from_logical_tree(self: &Self, e: &LogicalTreeAttachmentEventArgs)
```

Notifies the element that it has been detached from a rooted logical
tree. See `notify_attached_to_logical_tree`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L794)

<a id="function-get_effective_theme"></a>

### get_effective_theme

```rust
fn get_effective_theme(self: &Self) -> Option<Ref<ControlTheme>>
```

The theme in effect for the element: the `Theme` property if set,
otherwise the control theme resource keyed by the element's style key
that is visible to the element (a resource holding a
`Ref<ControlTheme>`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L905)

<a id="function-styles_added"></a>

### styles_added

```rust
fn styles_added(self: &Self, styles: &[Rc<dyn IStyle>])
```

Called when styles are added to the styles collection of the element
or a nested styles collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L1102)

<a id="function-styles_removed"></a>

### styles_removed

```rust
fn styles_removed(self: &Self, styles: &[Rc<dyn IStyle>])
```

Called when styles are removed from the styles collection of the
element or a nested styles collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L1110)

<a id="function-notify_resources_changed"></a>

### notify_resources_changed

```rust
fn notify_resources_changed(self: &Self, e: ResourcesChangedEventArgs, propagate: bool)
```

Notifies the element, and with `propagate` its children, that the
resources visible to it have changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L1140)

<a id="function-set_data_context_with_priority"></a>

### set_data_context_with_priority

```rust
fn set_data_context_with_priority(self: &Self, value: Option<BoxedValue>, priority: BindingPriority) -> Option<Rc<dyn IDisposable>>
```

The priority-aware setter used by templates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element.rs#L1216)

<a id="function-bind_class"></a>

### bind_class

```rust
fn bind_class(self: &Self, class_name: &str, source: &dyn BindingBase, anchor: Option<&Ref<FerroObject>>) -> Rc<dyn BindingExpressionBase>
```

Binds the presence of the class `class_name` on this element to
`source`. `anchor` provides the context the binding locates its source
with when the element cannot.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element_extensions.rs#L16)

<a id="function-get_class_property"></a>

### get_class_property

```rust
fn get_class_property(class_name: &str) -> &'static FerroProperty
```

The property a binding to the class `class_name` is set on.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_element_extensions.rs#L26)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`IDataContextProvider`](/docs/0.5.0/api/ferroui-base/trait-idatacontextprovider/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<StyledElement>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`IResourceNode`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourcenode/)
- [`IResourceHost`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourcehost/)
- [`IStyleHost`](/docs/0.5.0/api/ferroui-base/styling/trait-istylehost/)
- [`IThemeVariantHost`](/docs/0.5.0/api/ferroui-base/styling/trait-ithemevarianthost/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
