Changes

XAML Best practices

48 bytes added, 24 March
/* Improving performance on complex List item templates */
=== Overview ===
While working on Performance issues in XAML-based UI development, issues related to often stem from unnecessary UI rendering and binding errors and visibility conditions. These binding warnings were mostly harmless Hidden elements remain in terms of performance but cluttered the logs and could lead to confusionUI tree, impacting performance, while premature bindings cause background errors. To mitigate these issuesoptimize complex list item templates, we refined our XAML practices. This document details UI content can be loaded only when needed, and binding errors can be reduced by applying view models at the two primary lessons learned control level. These improvements enhance efficiency, reduce log clutter, and how we improved our implementationsimprove maintainability.
=== Lesson Technique 1: Loading UI content on demand ===
It was discovered that UI controls hidden with '''IsVisible=False''' remain in the UI tree. To improve performance on highly complex item templates, like UBIKTaskItem, rendered repeatedly such as in ListViews, a workaround can be applied to only load the UI content when the '''visibility''' binding condition is met.
'''Why This Change?'''
* '''Reduced Binding Warnings''': Using DataTrigger reducess unnecessary binding warnings.
* '''More Modular''': The separation into discrete templates makes individual UI elements reusable and maintainable.
* '''Better Performance''': Eliminates unnecessary loading of UI elements in the background, that are not visible to the user.
<br>
   === Lesson Technique 2: Reducing background Binding errors ===
Complex item templates such as UBIKTaskItem were found to produce large numbers of '''errors''' while rendering, likely as bindings are being resolved before the relevant '''viewmodels''' can be loaded by the client. While these '''errors''' are temporary and not visible to the user, the cumulative effect of numerous binding errors raised while rendering items can be felt when navigating to pages with large numbers of items.
<br>
{{Attention|Unfortunately, these bindings errors are not normally logged in the UBIKDebug.log. Therefore, the recommendation is to use the following technique when whenever using a ContentControl or controls:ContentControl.}}
==== Previous Approach ====
</source>
<br>
 
[[File:Binding_logs.png]]
 
 
==== Improved Approach ====
One workaround that reduced the number of '''binding errors''' encountered was to refer to '''viewmodels''' indirectly in the bindings.
117
edits

Help improve this page!