Stacklayout visible true false in listview

hello,

I am using listview controller where I bind data to listview from API 
But I want to show or hide the entire stacklayout from listview on some condition
Is it possible?
My List code

 <syncfusion:SfListView x:Name="TodayNotifyList" ItemSize="100">
                    <syncfusion:SfListView.ItemTemplate>
                        <DataTemplate>
                            <StackLayout>
                                <Grid RowSpacing="0">
                                    <Grid.RowDefinitions>
                                        <RowDefinition></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition></ColumnDefinition>
                                        <ColumnDefinition></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <StackLayout Orientation="Vertical">
                                        <StackLayout Orientation="Horizontal">
                                            <Label  Grid.Row="0" Grid.Column="0" x:Name="UserName" Text="{Binding UserName}" FontSize="16" FontFamily="Cabin"></Label>
                                            <Label Grid.Row="0" Grid.Column="0" Text="requested to follow you" FontSize="16" FontFamily="Cabin"/>
                                        </StackLayout>
                                        <Label  Grid.Row="0" Grid.Column="0" x:Name="TimeLbl"></Label>
                                    </StackLayout>
                                    <StackLayout x:Name="IncomingRequestUI">
                                        <buttons:SfButton Grid.Row="0" Grid.Column="1" x:Name="Acceptbtn"  Text="ACCEPT" CommandParameter="{Binding UserEmailId}" Clicked="AcceptbtnClicked" FontFamily="Cabin" TextColor="White" CornerRadius="5" VerticalOptions="Center">
                                            <buttons:SfButton.BackgroundGradient>
                                                <gradient:SfLinearGradientBrush>
                                                    <gradient:SfLinearGradientBrush.GradientStops>
                                                        <gradient:SfGradientStop Color="#650486" Offset="0"/>
                                                        <gradient:SfGradientStop Color="#9900CC" Offset="1"/>
                                                    </gradient:SfLinearGradientBrush.GradientStops>
                                                </gradient:SfLinearGradientBrush>
                                            </buttons:SfButton.BackgroundGradient>
                                        </buttons:SfButton>
                                        <buttons:SfButton Grid.Row="0" Grid.Column="1" x:Name="Rejectbtn"  Text="REJECT" CommandParameter="{Binding UserEmailId}" Clicked="RejectbtnClicked" FontFamily="Cabin" TextColor="#9900CC" CornerRadius="5" VerticalOptions="Center" BackgroundColor="White" BorderColor="#9900CC" BorderWidth="1">
                                        </buttons:SfButton>
                                    </StackLayout>
                                    <StackLayout x:Name="RequestAcceptUI">
                                        <Image></Image>
                                    </StackLayout>
                                    <StackLayout x:Name="PostLikeUI">
                                        <Image></Image>
                                    </StackLayout>
                                </Grid>
                            </StackLayout>
                        </DataTemplate>
                    </syncfusion:SfListView.ItemTemplate>
                </syncfusion:SfListView>


Here I want to hide/show IncomingRequestUI stacklayout on some condition

1 Reply

LN Lakshmi Natarajan Syncfusion Team December 10, 2020 12:11 PM UTC

Hi Shraddha, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “How to handle visibility in ListViewItems” from our side. We would like to inform you that you can achieve your requirement by binding StackLayout.IsVisible property and change the value based on condition. You can resize the ListViewItems when handling the visibility using the AutoFitMode as DynamicHeight. Please refer the following documentation for more reference, 
 
You can find the sample based on your requirement in the following link, 
 
Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 


Loader.
Up arrow icon