Skip to content

Commit ec2fa14

Browse files
committed
docs: Add BindableAttribute performance details
1 parent b64a6cb commit ec2fa14

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/articles/Uno-UI-Performance.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ Here's what to look for:
3232
- Bindings
3333
- Prefer bindings with short paths.
3434
- To shorten paths, use the `DataContext` property on containers, such as `StackPanel` or `Grid`.
35+
- Add the `Windows.UI.Xaml.BindableAttribute` or `System.ComponentModel.BindableAttribute` on non-DependencyObject classes.
36+
- When data binding to classes not inheriting from DependencyObject, in Debug configuration only, the following message may appear:
37+
```
38+
The Bindable attribute is missing and the type [XXXX] is not known by the MetadataProvider.
39+
Reflection was used instead of the binding engine and generated static metadata. Add the Bindable attribute to prevent this message and performance issues.
40+
```
41+
This message indicates that the binding engine will fall back on reflection based code, which is generally slow. To compensate for this, Uno use the `BindableTypeProvidersSourceGenerator`, which generates static non-generic code to avoid reflection operations during binding operations.
42+
This attribute is inherited and is generally used on ViewModel based classes.
3543
- [`x:Phase`](https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/x-phase-attribute)
3644
- For `ListView` instances with large templates, consider the use of x:Phase to reduce the number of bindings processed during item materialization.
3745
- It is only supported for items inside `ListViewItem` templates, it will be ignored for others.

0 commit comments

Comments
 (0)