This is a migrated thread and some comments may be shown as answers.

Expand collapse issue in IOS ListView Item

3 Answers 167 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Arun Kumar
Top achievements
Rank 1
Arun Kumar asked on 11 Feb 2016, 05:43 AM
Hi,
I am using telerik listview in our project, where we have a scenario the user can expand and collapse the content of the listview item and we use visibility to play with expand and collapse. when we collapse the listview item the height of that item is not getting reduced. the user can see the empty space when the item is collapsed.
Is there any way we can force the UI to get redraw, so that the empty space can be avoided or any other way can we solve this issue.

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 15 Feb 2016, 08:49 AM
Hello,

We cannot be sure for your setup. Could you please provide us with the customized DataTemplate you are using? It will help us to better understand exactly what you have in mind when you say "collapse" regarding a ListViewItem.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Arun Kumar
Top achievements
Rank 1
answered on 15 Feb 2016, 10:40 AM

Hi Pavel,

PFB the DataTemplate, In this Template we have created 2 Rows in a grid where when the user clicks on the Grid in first row the second row Grid's visibility gets collapsed. once agian the user click the Grid in first row the second row Grid's visibility gets visible.

This is how we achieve expand and collapse. but in IOS this is not working as expected.

please provide a solution or workaround to fix this.

 <DataTemplate>

          <listView:ListViewTemplateCell>
            <listView:ListViewTemplateCell.View>
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <Grid>
                <Grid.GestureRecognizers>
                  <TapGestureRecognizer
                      Command="{Binding ClickCommand}" CommandParameter="{Binding}"
                      NumberOfTapsRequired="1" />
                </Grid.GestureRecognizers>
                <Label HorizontalOptions="Center" VerticalOptions="Center" Text="List Item" TextColor="White" ></Label>
              </Grid>
              <Grid Grid.Row="1" HeightRequest="150" BackgroundColor="Green" IsVisible="{Binding IsVisible}" >
                <BoxView Color="Green" HeightRequest="150" />
              </Grid>
            </Grid>
            </listView:ListViewTemplateCell.View>
          </listView:ListViewTemplateCell>
        </DataTemplate>

 

Thanks,

Arun

0
Pavel R. Pavlov
Telerik team
answered on 17 Feb 2016, 11:44 AM
Hi arun,

Thank you for providing us with your code. It helped us understand your case. It is true that the RadListView in iOS does not update its items automatically. This is why we logged this issue in our backlog system. 

The workaround would be to manually trigger a layout cycle. This can be done by invalidating it using the adapter or by reloading your data.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Arun Kumar
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Arun Kumar
Top achievements
Rank 1
Share this question
or