Attributes
Last updated
Last updated
For each .NET Property defined on an Avalonia Control there is a corresponding Attribute. Most of them are Property Attributes, but not all of them.
Events are just like other attributes. You can easily recognize them by their prefix. Events are named like this
{ControlName}.on**{EventName}**
When subscribing to an event you can also provide SubPatchOptions
to configure when the subscription will be updated. If your handler function captures state you will run into issues if your handler captures state you'd expect to change.
In the example below the handler function captures current
. When the button is clicked we update the state with current + 1 but the value of current
in our handler function never changes.
Capturing state that changes over time should be avoided in most cases. You can provide FuncUI with a way of knowing when to update your handler function. Update handler function on render if current value changed:
Update handler function on each render pass:
By default, the handler function is only updated if the underlying delegate type changes.
Attached Attributes are used like Events and normal Properties.
{ControlName}.{name}
⚠ Currently not all attached properties are supported / declared. This is currently in process, feel free to create an issue if something is missing
Content Properties are attributes containing either a single View or a list of Views. They are often named content
, children
, viewItems
, … you get it.
Here are some examples.