In the current CollectionView implementation, the CollectionView will start with all the groups expanded. The only way to have any form of preference is to programmatically interact with the DataView after-the-fact https://docs.telerik.com/devtools/maui/controls/collectionview/grouping/expand-collapse
Requested FeatureSee simple example baaaaif/CollectionViewFilterIssue (MainPage.xaml.cs) to reproduce, click hide and show
When items are filtered through a FilterDescriptor they are hidden - correct
Trying to show the previously hidden items they don't appear again as expected - bug
I've used a BooleanFilterDescriptor and a DelegateFilterDescriptor, both don't work.
Stops me from using the RadCollectionView control
Hi Team,
Please consider adding a way to cancel a group's expand/collapse action when the user taps on the group header.
For example, through a GroupTapping event handler that fires just before GroupTapped, and we can execute logic that prevents the operation:
private void RadCollectionView_OnGroupTapping(object sender, RadTappingEventArgs<GroupContext> e)
{
if (e.Data.Key.ToString() == "GroupToStayPermanentlyExpanded")
{
e.Cancel();
}
}
// which uses this imaginary event args with Cancel method
public class RadTappingEventArgs<T>(T data) : RadTappedEventArgs<T>(data)
{
public void Cancel()
{
// prevents GroupTapped event
}
}
Thank you,
Rodrigo
Currently, the LoadOnDemandCollection accepts a callback of the following format in the constructor:
public LoadOnDemandCollection(Func<CancellationToken, IEnumerable> action)
It is a very common scenario to populate the items asynchronously. In its current form the collection would require blocking the current thread to populate the results:
ItemsSource = new LoadOnDemandCollection((cancelationToken) =>
{
var result = new List<ItemsModel>();
try
{
var items = dataService.GetItemsAsync().Result;
// TODO: Handle the result.
return result;
}
catch (Exception e)
{
// TODO: Handle the exception.
return null;
}
});
This is not desired, as using Task.Result blocks the current thread and is considered an anti-pattern, in general.
A better approach would be to add a second overload of the constructor, allowing asynchronous calls:
public LoadOnDemandCollection(Func<CancellationToken, Task<IEnumerable>> action)
This way we can use async and await in the callback instead:
ItemsSource = new LoadOnDemandCollection(async (cancelationToken) =>
{
var result = new List<ItemsModel>();
try
{
var items = await dataService.GetItemsAsync();
// TODO: Handle the result.
return result;
}
catch (Exception e)
{
// TODO: Handle the exception.
return null;
}
});
According to my tests, the first blocking approach is not a problem, as the LoadOnDemandCollection starts a thread internally. That behavior is not obvious however, and using Task.Result is somewhat counterintuitive, so the second approach is much better from the user's perspective.
we have additional field in City class (CountryFlag as Image)
public class City
{
public string Name { get; set; }
public string Country { get; set; }
public Image CountryFlag { get; set; }
}
We want to display the image instead of the property we group by. Provide such option to define which proeprty to be displayed in the group header.
Currently the group descriptors provide a SortOrder property, so the groups are sorted alphabetically in descending or ascending order. We would need to cover the following scenarios:
- allow certain groups to be ordered at the top, possibly by specifying an comparer or a separate group sort property.
- show the groups in order the corresponding items appear in the ItemsSource.