This is a migrated thread and some comments may be shown as answers.
ListView does not resize itself after an item is invisible
2 Answers 58 Views
This is a migrated thread and some comments may be shown as answers.
Unb
Top achievements
Rank 1
Unb asked on 26 Nov 2018, 12:23 PM

We have a list and by choosing a value, we hide some list items. The items become invisible, there is no problem but occupied places by items stay still after we set invisible. We use MVVM and this part works fine and we bind a property for IsVisible and it seems it works too. Only problem here, the list does not invalidate/refresh itself to re-arrange the view.

 I do not know why but I cannot attached the pictures..

So here is the my list

https://i.imgur.com/3wGJi3i.png

and here, after we made some invisible items..

https://i.imgur.com/SPzaE3s.png

I realize something.. After we set Invisible, the height of the custom control is still 37, and HeightRequest and MinimumHeightRequest are -1. I tried to change -1 to 0 but nothing changed.

 

Here is our listview Code and binding.,

 

<datacontrols:RadListView x:Name="listView" Grid.Row="1"  ItemsSource="{Binding FlatSource}"
                                                     SelectionMode="None" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
                                                     PropertyChanged="listView_PropertyChanged" >
                               <datacontrols:RadListView.GroupDescriptors>
                                   <telerikListView:PropertyGroupDescriptor PropertyName="GroupName" />
                               </datacontrols:RadListView.GroupDescriptors>
                               <datacontrols:RadListView.GroupHeaderTemplate>
                                   <DataTemplate>
                                       <Grid BackgroundColor="{StaticResource CustomBaseGrayColor}" Margin="0,5,0,0">
                                           <Grid.ColumnDefinitions>
                                               <ColumnDefinition Width="Auto" />
                                               <ColumnDefinition />
                                           </Grid.ColumnDefinitions>
                                           <Label Text="▸" Margin="8, 9, 0, 3" TextColor="{StaticResource CustomBlackTextColor}" FontSize="Medium">
                                               <Label.Triggers>
                                                   <DataTrigger TargetType="Label" Binding="{Binding IsExpanded}" Value="True">
                                                       <Setter Property="Text" Value="▾" />
                                                   </DataTrigger>
                                               </Label.Triggers>
                                           </Label>
                                           <Label Text="{Binding }"  Margin="0, 11, 0, 3" Grid.Column="1"  HorizontalOptions="Start" Style="{StaticResource GrouppingTitle}"   />
                                       </Grid>
                                   </DataTemplate>
                               </datacontrols:RadListView.GroupHeaderTemplate>
                               <datacontrols:RadListView.ItemTemplate>
                                   <DataTemplate>
                                       <telerikListView:ListViewTemplateCell>
                                           <telerikListView:ListViewTemplateCell.View>
                                               <Grid BackgroundColor="{StaticResource CustomBaseGrayColor}" ColumnSpacing="0"  VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                                                   <Grid.ColumnDefinitions>
                                                       <ColumnDefinition Width="10"/>
                                                       <ColumnDefinition Width="*" />
                                                   </Grid.ColumnDefinitions>
                                                   <BoxView Color="{StaticResource CustomBlackTextColor}" Grid.Column="0" VerticalOptions="FillAndExpand" WidthRequest="10" />
                                               <customCellItem:ThreeColumnCellItem Grid.Column="1"                                       
                                           KeyLabelText="{Binding ParamName}"
                                           ValueLabelText="{Binding CurrentValue}"
                                           ModifiedValueEntryText="{Binding NewValue}"
                                           DataItem ="{Binding DataItem}"       
                                           FieldParamType="{Binding ParamType}"   
                                           HorizontalOptions="Fill" VerticalOptions="Fill"
                                           Entry_Tapped="OnTappedEntry"
                                           Margin="0,0,0,10"                                                                                       
                                           IsVisible="{Binding IsVisible}"
                                           IsEnabled="{Binding !IsReadOnly}"
                                           />
                                           </Grid>
                                           </telerikListView:ListViewTemplateCell.View>
                                       </telerikListView:ListViewTemplateCell>
                                   </DataTemplate>
                               </datacontrols:RadListView.ItemTemplate>
                           </datacontrols:RadListView>

 

Normally ListView from Xamarin.Forms has a property HasUnevenRows. I believe that It may work but RadListView has not this property.

Thank you in advance.

 

 

 

2 Answers, 1 is accepted

Sort by
0
Unb
Top achievements
Rank 1
answered on 30 Nov 2018, 03:04 PM
the problem has not been solved yet. Is there any idea?
0
Unb
Top achievements
Rank 1
answered on 03 Dec 2018, 12:07 PM

Solved

 

https://forums.xamarin.com/discussion/145767/listview-does-not-resize-itself-after-an-item-is-invisible#latest

Asked by
Unb
Top achievements
Rank 1
Answers by
Unb
Top achievements
Rank 1
Share this question
or