- Home
- Forum
- Xamarin.Forms
- GroupHeader doesn't trigger refresh when collapsing
GroupHeader doesn't trigger refresh when collapsing
I wrote a Converter which is translating the GroupResult into an Icon.
<Image x:Name="NormalImage" HorizontalOptions="EndAndExpand" Margin="10,0,10,0"
IsVisible="{Binding Key, Converter={StaticResource GroupHeaderVisibilityConverter}, FallbackValue=false, TargetNullValue=false}">
<Image.Source>
<FontImageSource Color="{DynamicResource TextPrimaryColor}"
Glyph="{Binding ., Converter={StaticResource GroupToExpandFontConverter}}"
FontFamily="{DynamicResource BoxPlannerFonts}"
Size="Default"
/>
</Image.Source>
</Image>
which works great when, but ONLY when I manually refresh the listView by calling RefreshListViewItem(-1, -1, true);
when using attributes of the GroupResult for a converter like Level or IsExpand then this is not necessary.
Is it possible that there is a refresh missing when expanding and collapsing on the groupResult?
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
SS
SaiGanesh Sakthivel
Syncfusion Team
March 22, 2021 12:34 PM UTC
Hi Michael,
Thank you for contacting syncfusion support.
#Regarding expand or collapse icon in group header of SfListView
We would like to inform you that we have already documented about “How to add expand or collapse icon in group header of SfListView ‘’ in our Syncfusion Knowledge base. You can refer the same from the following location.
KB link: https://www.syncfusion.com/kb/7518/how-to-add-expand-or-collapse-icon-in-group-header-of-sflistview
We hope this helps. Please let us know if you need any further assistance.
Regards,
SaiGanesh Sakthivel
SaiGanesh Sakthivel
MI
Michael
March 22, 2021 12:56 PM UTC
Unfortunately the outlined documentation does only work with an attribute of the group result, but not with the group result object.
That means I can only work with either level or isexpand, but I can't build logic for both...
SS
SaiGanesh Sakthivel
Syncfusion Team
March 23, 2021 04:21 PM UTC
Hi Michael,
Thank you for the update.
#Regarding GroupHeader doesn't trigger refresh when collapsing
Thank you for the update.
#Regarding GroupHeader doesn't trigger refresh when collapsing
We would like to inform you that you can achieved your requirement with help of GroupHeader Converter and calling the RefreshListviewItem method for listview inside the Collapsed event. Please refer to the following code snippet for your reference.
Code snippet
Code snippet
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if ((value as GroupResult).IsExpand == true && (value as GroupResult).Level==1)
return ImageSource.FromResource("MultiLevelGrouping.Images.GroupExpand.png");
else if((value as GroupResult).IsExpand == true && (value as GroupResult).Level == 2)
return ImageSource.FromResource("MultiLevelGrouping.Images.GroupExpand.png");
else if ((value as GroupResult).IsExpand == false && (value as GroupResult).Level == 1)
return ImageSource.FromResource("MultiLevelGrouping.Images.GroupCollapse.png");
else
return ImageSource.FromResource("MultiLevelGrouping.Images.GroupCollapse.png");
}
return null;
} |
Calling Refresh method inside the collapse event and expand event.
|
private void listView_GroupExpanded(object sender, GroupExpandCollapseChangedEventArgs e)
{
listView.RefreshListViewItem(-1, -1, true);
}
private void listView_GroupCollapsed(object sender, GroupExpandCollapseChangedEventArgs e)
{
listView.RefreshListViewItem(-1, -1, true);
} |
Please refer to the tested sample in the following link for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/MultiLevelGrouping451293859
Please let us know if you have any concern.
Regards,
SaiGanesh Sakthivel
Regards,
SaiGanesh Sakthivel
Marked as answer
MI
Michael
March 23, 2021 04:47 PM UTC
This is pretty much exactly what I tried, as described in issue about the error caused by this.
I will try to manipulate your example to reproduce the issue.
SS
SaiGanesh Sakthivel
Syncfusion Team
March 24, 2021 08:59 AM UTC
Hi Michael,
Thank you for the update.
We will wait until your further response.
Thank you for the update.
We will wait until your further response.
Regards,
SaiGanesh Sakthivel
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
MI Michael
- Mar 21, 2021 10:12 AM UTC
- Mar 24, 2021 08:59 AM UTC