Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I would like to have GridView with CollectionViewSource but I need only headers without content sometimes, so I have a method:

internal List<GroupInfoList<object>> GetGroupsByLetter()
    {
        List<GroupInfoList<object>> groups = new List<GroupInfoList<object>>();
        var cars = Glue.cache.userData.Cars;
        foreach (var car in cars)
        {
            GroupInfoList<object> info = new GroupInfoList<object>();
            info.Key = car.Name;
            foreach (var reminder in Glue.cache.userData.Reminders.Where(r => r.CarId == car.Id))
            {
                info.Add(new ReminderWithCar(reminder, Glue.cache.userData.Cars.Where(c => c.Id == reminder.CarId).First()));
            }

            groups.Add(info);
        }

        return groups;
    }

    public class GroupInfoList<T> : List<object>
    {
        public object Key { get; set; }

        public new IEnumerator<object> GetEnumerator()
        {
            return (System.Collections.Generic.IEnumerator<object>) base.GetEnumerator();
        }
    }

and if element (car) have not any elements (reminders) it doesn't appear. (Windows 8 App)

Help, please.

share|improve this question
    
In your GridView set the GroupStyle's HidesIfEmpty to false. Then have your viewmodel filter out the groups so that it only returns empty groups. –  Nate Diamond May 23 '13 at 22:16
1  
Ok. Thanks. Eventually I did GridView with GridViews in it ;) –  Mateusz Skalniak May 24 '13 at 12:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.