|
<StackLayout>
<Button x:Name="button" Text="Change header" HeightRequest="50"/>
<syncfusion:SfListView x:Name="listView" ItemsSource="{Binding ContactsInfo}" AutoFitMode="DynamicHeight">
<syncfusion:SfListView.ItemTemplate >
<DataTemplate>
...
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
<syncfusion:SfListView.HeaderTemplate>
<DataTemplate>
<StackLayout BackgroundColor="LightSkyBlue">
<StackLayout IsVisible="{Binding IsListViewNotEmpty, Converter={StaticResource InverseBoolConverter}}">
<StackLayout HeightRequest="80" WidthRequest="80" Margin="0,80,0,0" HorizontalOptions="CenterAndExpand">
<Image Source="Add.png" HeightRequest="80" WidthRequest="80" HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<Label HorizontalOptions="CenterAndExpand" HorizontalTextAlignment="Center" Margin="30"/>
<Button Text="Add New" Margin="60,10" HorizontalOptions="FillAndExpand"/>
</StackLayout>
<StackLayout IsVisible="{Binding IsListViewNotEmpty}">
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Padding="0,20,0,20">
<StackLayout.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean" iOS="False" Android="True"/>
</StackLayout.IsVisible>
<Image Source="Add.png" HeightRequest="32"/>
<Label >MyList</Label>
</StackLayout>
</StackLayout>
</StackLayout>
</DataTemplate>
</syncfusion:SfListView.HeaderTemplate>
</syncfusion:SfListView>
</StackLayout> |
|
private void Button_Clicked(object sender, EventArgs e)
{
((sender as Button).BindingContext as ContactsViewModel).IsListViewNotEmpty = !((sender as Button).BindingContext as ContactsViewModel).IsListViewNotEmpty;
ListView.RefreshView();
} |