Jump to: navigation, search

Changes


XAML Best practices

1,919 bytes added, 24 June
/* How to select the right Control */ Continued
* 🏆 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 other item controls, or BindableLayouts , unless you are sure the performance impact will be negligible.* Layouts:** If you want to define a specific layout for a page, use a Grid with rows and columns.** If things need to be positioned relative to each other, use a StackPanel/StackLayout.** When defining Rows/Columns for a Grid, assign as few Auto size as possible, and avoid putting controls of unlimited size in an Auto Row.** 🏆 Controls of unrestricted size, such as ListView, should never be nested within controls of unlimited size, such as a StackPanel/StackLayout.*** To clarify: Some controls resize themselves based on their content and can be of unlimited size. One example is a StackPanel/StackLayout, when compared to a Grid, which is limited to the screen's size. ListViews require a fixed size in order to preserve [[XAML_Best_practices#Virtualization|virtualization]].* Do not nest ScrollViews within other ScrollViews. ** Note that this includes '''any''' control with scrolling behavior, as these include a hidden built-in ScrollView. For example, never place a ListView or TreeView within a ScrollView.* Nested ListViews involves using a ListView on the item template of an object already presented in a collection. For example, showing the children of a child object.** This is especially an issue in Xamarin, both for performance, but also because sfListViewExt tends to cause layouting issues by taking up more space than needed, unlike in UWP where a ListViewExt is capable of calculating its size based on the size of its items. Therefore, when using nested ListViews in Xamarin, constrain the size of the inner ListView with a fixed HeightRequest attribute (or WidthRequest in the case of a horizontal list).** ⚠️ Alternatives to the optimized ListViews (SelectionBoundListView on UWP and SfListViewExt on Xamarin), such as CollectionView or BindableLayout, should be used with extreme caution, as these are not optimized for good performance in UBIK. 
511
edits