I am developing a xamarin.forms app that would be available for android & ios phones.
I urgently need to add listview grouping ability to my menu.
I would like the Record Abuse Item, for example to have Record Audio, Take a Picture, Take a Video, Livestream , etc as Children that would appear underneath it when a user taps on it.
I basically need someone to look at my code and insert the relevant portions that would allow me to achieve my objective.
This is where the Item is defined as a Class:
I have defined a sub_item class and I don't know what to do next to link the sub_items with the Items:
This is where the Item class is collecting its data from:
I am expecting a quick response to help in resolving this issue.
Thanks.
I urgently need to add listview grouping ability to my menu.
I would like the Record Abuse Item, for example to have Record Audio, Take a Picture, Take a Video, Livestream , etc as Children that would appear underneath it when a user taps on it.
I basically need someone to look at my code and insert the relevant portions that would allow me to achieve my objective.
This is where the Item is defined as a Class:
C#:
public class Item
{
public string Id { get; set; }
public string Text { get; set; }
public string Description { get; set; }
}
C#:
public class Sub_Item
{
public string Id { get; set; }
public string Text { get; set; }
public string Description { get; set; }
public Item Item { get; set; }
}
C#:
public class MockDataStore : IDataStore<Item>
{
readonly List<Item> items;
public MockDataStore()
{
items = new List<Item>()
{
new Item { Id = Guid.NewGuid().ToString(), Text = "Report Abuse" Description="Initiate (audiovisual) recording for unfolding event around you, which can either be transmitted simultaneously or stored on your phone for later transmission." },
new Item { Id = Guid.NewGuid().ToString(), Text = "RED Zone", Description="View or manage (if your are the Admin) dangerous areas that have been automatically identified by the app or manually captured (by the Admin)." },
new Item { Id = Guid.NewGuid().ToString(), Text = "Location Inquiry", Description="Make use of GPS to determine your current location." },
new Item { Id = Guid.NewGuid().ToString(), Text = "Notify", Description="Notify specific people of your present situation." },
new Item { Id = Guid.NewGuid().ToString(), Text = "Voice2Text", Description="Voice to text translator." },
new Item { Id = Guid.NewGuid().ToString(), Text = "Support & Counselling", Description="You can either browse through our recommended tips of what to do before or after an abuse has occured or Chat with a representative for support and counselling." },
new Item { Id = Guid.NewGuid().ToString(), Text = "Options", Description="Setup and configure several settings for the app." }
};
}
public async Task<bool> AddItemAsync(Item item)
{
items.Add(item);
return await Task.FromResult(true);
}
public async Task<bool> UpdateItemAsync(Item item)
{
var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
items.Remove(oldItem);
items.Add(item);
return await Task.FromResult(true);
}
public async Task<bool> DeleteItemAsync(string id)
{
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
items.Remove(oldItem);
return await Task.FromResult(true);
}
public async Task<Item> GetItemAsync(string id)
{
return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
}
public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
{
return await Task.FromResult(items);
}
}
}
Thanks.
Attachments
Last edited by a moderator: