Changes

XAML Best practices

1,613 bytes added, 24 June
Is this the best control?-section WIP
=== Is this the best control? ===
Controls often have similar functionality, making it difficult to decide which to use, making the question of which control to use highly ambiguous.
For clarity, a 'Control' refers to a single xaml object that can be added to your visual tree. These range in scope and purpose, from layouting (such as a Grid or StackPanel), to interactivity (such as a Button or TextBox), and everything in between (such as a ListView).
So, how to choose the best control to meet your requirements?
==== Best Practices ====* 🏆 A good rule of thumb is to always use the least complex control possible. ** For example, there is no need to use a Filter + ListView to show a single UBIK object or property. Instead, you can bind the specific context of that object or property to a xaml control, and everything nested inside will inherit that binding context. This will be explained more in the section on [[XAML_Best_practices#Reusable_Templates|Reusable Templates]].** Similarly, simple EvalExpressions can in many cases be replaced with [[XAML_Best_practices#Converters|Converters]].** The Visibility attribute can be added to any control. There is no need to wrap any control in a Grid simply to apply a Visibility. The same goes for layouting attributes such as Grid.Row/Column.* 🏆 When you need to show a collection of items such as ListView, always use our custom versions. These are UBIK-optimized for speed and performance.** These are SelectionBoundListView on UWP and SfListViewExt on Xamarin.     ** Avoid using BindableLayouts unless you are sure the performance impact will be negligible.
487
edits