Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# How to show empty message when listview has no items in xamarin forms
This example demonstrates to show empty message when listview has no items by using the visibility property.

## Sample

```xaml
<Grid Padding="{OnPlatform iOS='0,40,0,0'}">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button x:Name="ItemSource" Grid.Row="0"
Text="Change ItemSource"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Command="{Binding OnItemsSourceChanged}"/>
<Grid IsVisible="{Binding IsVisible}" Grid.Row="1">
<Label x:Name="label"
Text = "No Items :("
FontSize ="Default"
HorizontalOptions = "FillAndExpand"
HorizontalTextAlignment = "Center"
VerticalTextAlignment = "Center"
VerticalOptions = "FillAndExpand"/>
</Grid>
<syncfusion:SfListView x:Name="listView" Grid.Row="1" ItemsSource="{Binding ContactsInfo}"
IsVisible="{Binding Path=IsVisible, Converter={StaticResource visibilityConverter}}"
ItemSpacing="2" ItemSize="30">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Label Text="{Binding ContactName}"/>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
</Grid>
```

See [How to show empty message when listview has no items in Xamarin.Forms](https://www.syncfusion.com/kb/9956/how-to-show-empty-message-when-listview-has-no-items-in-xamarin-forms) for more details.
## <a name="requirements-to-run-the-demo"></a>Requirements to run the demo ##

Expand Down