This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Enhancement] EmptyView for BindableLayout #6932
Labels
a/bindablelayout
in-progress
This issue has an associated pull request that may resolve it!
proposal-accepted
t/enhancement ➕
Summary
Add an EmptyView property to BindableLayout which, when set, displays if there are no other items in the layout.
This is basically a duplicate of the EmptyView feature on CollectionView.
API Changes
In
BindableLayout
, add:public static readonly BindableProperty EmptyViewProperty = BindableProperty.Create(nameof(EmptyView), typeof(object), typeof(Layout<View>), null);
public static readonly BindableProperty EmptyViewTemplateProperty = BindableProperty.Create(nameof(EmptyViewTemplate), typeof(DataTemplate), typeof(Layout<View>), null);
Intended Use Case
In the following example, if
ItemsSource
contains any items, they will be displayed in the StackLayout and EmptyView will not be visible. IfItemSource
contains no items, the EmptyView will be displayed as the sole element in the StackLayout.If EmptyViewTemplate is set, the template content will be displayed with EmptyView as the binding context for the template content.
If EmptyViewTemplate is not set, the following rules apply:
ToString(InvariantCulture)
representation is displayed as a Label.The text was updated successfully, but these errors were encountered: